summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/default.nix')
-rw-r--r--accounts/gkleen@sif/default.nix57
1 files changed, 4 insertions, 53 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix
index 47d2212b..e6cbd77d 100644
--- a/accounts/gkleen@sif/default.nix
+++ b/accounts/gkleen@sif/default.nix
@@ -88,55 +88,7 @@ let
88 exec -a "$1" "$@" 88 exec -a "$1" "$@"
89 ''; 89 '';
90 90
91 lockCommand = pkgs.writeShellScript "gtklock" '' 91 lockCommand = "${config.systemd.package}/bin/systemctl --user start gtklock.service";
92 set -x
93
94 export PATH="${lib.makeBinPath [cfg.programs.wpaperd.package pkgs.jq pkgs.coreutils pkgs.gtklock pkgs.imagemagick pkgs.findutils pkgs.libsForQt5.qt5.qttools pkgs.systemd]}:$PATH"
95
96 qdbus org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases
97 systemctl --user --no-block stop gpg-agent.service
98
99 tmpDir=$(mktemp -d --tmpdir="$RUNTIME_DIRECTORY" "gtklock.$(date -uIs).XXXXXXXX")
100
101 args=()
102
103 cp --no-preserve=mode ${pkgs.writeText "gtklock.css" ''
104 #window-box {
105 padding: 64px;
106 /* border: 1px solid black; */
107 border-radius: 4px;
108 box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px;
109 /* background-color: white; */
110 background-color: rgba(0, 0, 0, 0.5);
111 }
112 ''} "$tmpDir"/style.css
113
114 monitors=()
115 while IFS= read -r entry; do
116 path=$(jq -r ".path" <<<"$entry")
117 [[ -z "$path" || ! -f "$path" ]] && continue
118 display=$(jq -r ".display" <<<"$entry")
119 monitors+=("$display")
120 # ln -s "$path" "$tmpDir"/"$display"."''${path##*.}"
121 magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$tmpDir"/"$display"."''${path##*.}" &
122 done < <(wpaperctl all-wallpapers -j | jq -c ".[]")
123 wait
124 for monitor in "''${monitors[@]}"; do
125 path=$(find "$tmpDir" -name "$monitor"'.*')
126 cat >>"$tmpDir"/style.css <<EOF
127 window#''${monitor} {
128 background-image: url("''${path}");
129 background-repeat: no-repeat;
130 background-size: 100% 100%;
131 background-origin: content-box;
132 }
133 EOF
134 done
135 args+=("-s" "$tmpDir"/style.css)
136
137 args+=("$@")
138 exec gtklock "''${args[@]}"
139 '';
140in { 92in {
141 imports = with flake.nixosModules.userProfiles.${userName}; [ 93 imports = with flake.nixosModules.userProfiles.${userName}; [
142 mpv yt-dlp (args: import ./xcompose.nix (inputs // args)) 94 mpv yt-dlp (args: import ./xcompose.nix (inputs // args))
@@ -659,16 +611,15 @@ in {
659 swayidle = { 611 swayidle = {
660 enable = true; 612 enable = true;
661 events = [ 613 events = [
662 { event = "before-sleep"; command = "${lockCommand} -d"; } 614 { event = "before-sleep"; command = lockCommand; }
663 { event = "after-resume"; command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; } 615 { event = "after-resume"; command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; }
664 { event = "lock"; command = "${lockCommand} -d"; } 616 { event = "lock"; command = lockCommand; }
665 ]; 617 ];
666 timeouts = [ 618 timeouts = [
667 { timeout = 300; 619 { timeout = 300;
668 command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; 620 command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off";
669 resumeCommand = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on";
670 } 621 }
671 { timeout = 330; command = "${lockCommand} -d"; } 622 { timeout = 330; command = lockCommand; }
672 ]; 623 ];
673 extraArgs = [ 624 extraArgs = [
674 "idlehint" "30" 625 "idlehint" "30"