summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/systemd.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-01-23 15:36:31 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2025-01-23 15:36:31 +0100
commit08414045a56517d95e94f55c406ec8940336c6c7 (patch)
treec892416476e41a8df5a08b094db2eb992be8de78 /accounts/gkleen@sif/systemd.nix
parent6283e7caeb1cf4dc953671ec11956430cf6aa0c5 (diff)
downloadnixos-08414045a56517d95e94f55c406ec8940336c6c7.tar
nixos-08414045a56517d95e94f55c406ec8940336c6c7.tar.gz
nixos-08414045a56517d95e94f55c406ec8940336c6c7.tar.bz2
nixos-08414045a56517d95e94f55c406ec8940336c6c7.tar.xz
nixos-08414045a56517d95e94f55c406ec8940336c6c7.zip
...
Diffstat (limited to 'accounts/gkleen@sif/systemd.nix')
-rw-r--r--accounts/gkleen@sif/systemd.nix84
1 files changed, 43 insertions, 41 deletions
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 {
207 RuntimeDirectory = "gtklock"; 207 RuntimeDirectory = "gtklock";
208 CacheDirectory = "gtklock"; 208 CacheDirectory = "gtklock";
209 ExecStartPre = [ 209 ExecStartPre = [
210 "${pkgs.libsForQt5.qt5.qttools.bin}/bin/qdbus org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases" 210 "${lib.getExe' pkgs.libsForQt5.qt5.qttools.bin "qdbus"} org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases"
211 "${config.systemd.package}/bin/systemctl --user stop gpg-agent.service" 211 "${lib.getExe' config.systemd.package "systemctl"} --user stop gpg-agent.service"
212 (pkgs.writeShellScript "generate-css" '' 212 "${lib.getExe pkgs.playerctl} -a pause"
213 set -x 213 (lib.getExe (pkgs.writeShellApplication {
214 export PATH="${lib.makeBinPath [cfg.programs.wpaperd.package pkgs.jq pkgs.coreutils pkgs.imagemagick pkgs.findutils]}:$PATH" 214 name = "generate-css";
215 runtimeInputs = with pkgs; [cfg.programs.wpaperd.package jq coreutils imagemagick findutils];
216 text = ''
217 declare -A monitors
218 monitors=()
219 while IFS= read -r entry; do
220 path=$(jq -r ".path" <<<"$entry")
221 [[ -z "$path" || ! -f "$path" ]] && continue
222 blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}"
223 monitor=$(jq -r ".display" <<<"$entry")
224 if [[ ! -f "$blurred_path" ]]; then
225 mkdir -p "$(dirname "$blurred_path")"
226 magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" &
227 fi
228 monitors+=([$monitor]="$blurred_path")
229 done < <(wpaperctl all-wallpapers -j | jq -c ".[]")
230 # wait
215 231
216 declare -A monitors 232 cp --no-preserve=mode ${pkgs.writeText "gtklock.css" ''
217 monitors=() 233 #window-box {
218 while IFS= read -r entry; do 234 padding: 64px;
219 path=$(jq -r ".path" <<<"$entry") 235 /* border: 1px solid black; */
220 [[ -z "$path" || ! -f "$path" ]] && continue 236 border-radius: 4px;
221 blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}" 237 box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px;
222 monitor=$(jq -r ".display" <<<"$entry") 238 /* background-color: white; */
223 if [[ ! -f "$blurred_path" ]]; then 239 background-color: rgba(0, 0, 0, 0.5);
224 mkdir -p "$(dirname "$blurred_path")" 240 }
225 magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" & 241 ''} "$RUNTIME_DIRECTORY"/style.css
226 fi 242 for monitor in "''${!monitors[@]}"; do
227 monitors+=([$monitor]="$blurred_path") 243 cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF
228 done < <(wpaperctl all-wallpapers -j | jq -c ".[]") 244 window#''${monitor} {
229 # wait 245 background-image: url("''${monitors[$monitor]}");
230 246 background-repeat: no-repeat;
231 cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' 247 background-size: 100% 100%;
232 #window-box { 248 background-origin: content-box;
233 padding: 64px;
234 /* border: 1px solid black; */
235 border-radius: 4px;
236 box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px;
237 /* background-color: white; */
238 background-color: rgba(0, 0, 0, 0.5);
239 } 249 }
240 ''} "$RUNTIME_DIRECTORY"/style.css 250 EOF
241 for monitor in "''${!monitors[@]}"; do 251 done
242 cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF 252 '';
243 window#''${monitor} { 253 }))
244 background-image: url("''${monitors[$monitor]}");
245 background-repeat: no-repeat;
246 background-size: 100% 100%;
247 background-origin: content-box;
248 }
249 EOF
250 done
251 '')
252 ]; 254 ];
253 NotifyAccess = "all"; 255 NotifyAccess = "all";
254 ExecStart = ''${lib.getExe pkgs.gtklock} -s "''${RUNTIME_DIRECTORY}/style.css" -L ${pkgs.writeShellScript "after-lock" '' 256 ExecStart = ''${lib.getExe pkgs.gtklock} -s "''${RUNTIME_DIRECTORY}/style.css" -L ${pkgs.writeShellScript "after-lock" ''
255 ${lib.getExe cfg.programs.niri.package} msg action power-off-monitors 257 ${lib.getExe cfg.programs.niri.package} msg action power-off-monitors
256 ${config.systemd.package}/bin/systemd-notify --ready 258 ${lib.getExe' config.systemd.package "systemd-notify"} --ready
257 ''}''; 259 ''}'';
258 }; 260 };
259 }; 261 };