From 08414045a56517d95e94f55c406ec8940336c6c7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 23 Jan 2025 15:36:31 +0100 Subject: ... --- accounts/gkleen@sif/systemd.nix | 84 +++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 41 deletions(-) (limited to 'accounts/gkleen@sif/systemd.nix') diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index bce2f4cd..7e83662f 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix @@ -207,53 +207,55 @@ in { RuntimeDirectory = "gtklock"; CacheDirectory = "gtklock"; ExecStartPre = [ - "${pkgs.libsForQt5.qt5.qttools.bin}/bin/qdbus org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases" - "${config.systemd.package}/bin/systemctl --user stop gpg-agent.service" - (pkgs.writeShellScript "generate-css" '' - set -x - export PATH="${lib.makeBinPath [cfg.programs.wpaperd.package pkgs.jq pkgs.coreutils pkgs.imagemagick pkgs.findutils]}:$PATH" + "${lib.getExe' pkgs.libsForQt5.qt5.qttools.bin "qdbus"} org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases" + "${lib.getExe' config.systemd.package "systemctl"} --user stop gpg-agent.service" + "${lib.getExe pkgs.playerctl} -a pause" + (lib.getExe (pkgs.writeShellApplication { + name = "generate-css"; + runtimeInputs = with pkgs; [cfg.programs.wpaperd.package jq coreutils imagemagick findutils]; + text = '' + declare -A monitors + monitors=() + while IFS= read -r entry; do + path=$(jq -r ".path" <<<"$entry") + [[ -z "$path" || ! -f "$path" ]] && continue + blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}" + monitor=$(jq -r ".display" <<<"$entry") + if [[ ! -f "$blurred_path" ]]; then + mkdir -p "$(dirname "$blurred_path")" + magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" & + fi + monitors+=([$monitor]="$blurred_path") + done < <(wpaperctl all-wallpapers -j | jq -c ".[]") + # wait - declare -A monitors - monitors=() - while IFS= read -r entry; do - path=$(jq -r ".path" <<<"$entry") - [[ -z "$path" || ! -f "$path" ]] && continue - blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}" - monitor=$(jq -r ".display" <<<"$entry") - if [[ ! -f "$blurred_path" ]]; then - mkdir -p "$(dirname "$blurred_path")" - magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" & - fi - monitors+=([$monitor]="$blurred_path") - done < <(wpaperctl all-wallpapers -j | jq -c ".[]") - # wait - - cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' - #window-box { - padding: 64px; - /* border: 1px solid black; */ - border-radius: 4px; - box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; - /* background-color: white; */ - background-color: rgba(0, 0, 0, 0.5); + cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' + #window-box { + padding: 64px; + /* border: 1px solid black; */ + border-radius: 4px; + box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; + /* background-color: white; */ + background-color: rgba(0, 0, 0, 0.5); + } + ''} "$RUNTIME_DIRECTORY"/style.css + for monitor in "''${!monitors[@]}"; do + cat >>"$RUNTIME_DIRECTORY"/style.css <>"$RUNTIME_DIRECTORY"/style.css <