summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/default.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2024-08-12 14:31:26 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2024-08-12 14:31:26 +0200
commit3b4f9240fb6393c693b2a8ad99f20309cc48c26d (patch)
tree7c06a8433f7ecb6247e8091915bddeb932968fb0 /accounts/gkleen@sif/default.nix
parent6fc314254a10ea2e6f042ce91deb1459b60d0674 (diff)
downloadnixos-3b4f9240fb6393c693b2a8ad99f20309cc48c26d.tar
nixos-3b4f9240fb6393c693b2a8ad99f20309cc48c26d.tar.gz
nixos-3b4f9240fb6393c693b2a8ad99f20309cc48c26d.tar.bz2
nixos-3b4f9240fb6393c693b2a8ad99f20309cc48c26d.tar.xz
nixos-3b4f9240fb6393c693b2a8ad99f20309cc48c26d.zip
...
Diffstat (limited to 'accounts/gkleen@sif/default.nix')
-rw-r--r--accounts/gkleen@sif/default.nix56
1 files changed, 53 insertions, 3 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix
index a0ffc581..7ff0afc6 100644
--- a/accounts/gkleen@sif/default.nix
+++ b/accounts/gkleen@sif/default.nix
@@ -94,6 +94,53 @@ let
94 export __VK_LAYER_NV_optimus=NVIDIA_only 94 export __VK_LAYER_NV_optimus=NVIDIA_only
95 exec -a "$1" "$@" 95 exec -a "$1" "$@"
96 ''; 96 '';
97
98 lockCommand = pkgs.writeShellScript "gtklock" ''
99 set -x
100
101 export PATH="${lib.makeBinPath [cfg.programs.wpaperd.package pkgs.jq pkgs.coreutils pkgs.gtklock pkgs.imagemagick pkgs.findutils]}:$PATH"
102
103 tmpDir=$(mktemp -d --tmpdir="$RUNTIME_DIRECTORY" "gtklock.$(date -uIs).XXXXXXXX")
104
105 args=()
106
107 cp --no-preserve=mode ${pkgs.writeText "gtklock.css" ''
108 #window-box {
109 padding: 64px;
110 /* border: 1px solid black; */
111 border-radius: 4px;
112 box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px;
113 /* background-color: white; */
114 background-color: rgba(0, 0, 0, 0.5);
115 }
116 ''} "$tmpDir"/style.css
117
118 monitors=()
119 while IFS= read -r entry; do
120 path=$(jq -r ".path" <<<"$entry")
121 [[ -z "$path" || ! -f "$path" ]] && continue
122 display=$(jq -r ".display" <<<"$entry")
123 monitors+=("$display")
124 # ln -s "$path" "$tmpDir"/"$display"."''${path##*.}"
125 magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$tmpDir"/"$display"."''${path##*.}" &
126 done < <(wpaperctl all-wallpapers -j | jq -c ".[]")
127 wait
128 for monitor in "''${monitors[@]}"; do
129 path=$(find "$tmpDir" -name "$monitor"'.*')
130 cat >>"$tmpDir"/style.css <<EOF
131 window#''${monitor} {
132 background-image: url("''${path}");
133 background-repeat: no-repeat;
134 background-size: 100% 100%;
135 background-origin: content-box;
136 }
137 EOF
138 done
139 args+=("-s" "$tmpDir"/style.css)
140
141 args+=("$@")
142 exec gtklock "''${args[@]}"
143 '';
97in { 144in {
98 imports = with flake.nixosModules.userProfiles.${userName}; [ 145 imports = with flake.nixosModules.userProfiles.${userName}; [
99 mpv yt-dlp (args: import ./xcompose.nix (inputs // args)) 146 mpv yt-dlp (args: import ./xcompose.nix (inputs // args))
@@ -696,16 +743,16 @@ in {
696 swayidle = { 743 swayidle = {
697 enable = true; 744 enable = true;
698 events = [ 745 events = [
699 { event = "before-sleep"; command = "${lib.getExe pkgs.gtklock} -d"; } 746 { event = "before-sleep"; command = "${lockCommand} -d"; }
700 { event = "after-resume"; command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; } 747 { event = "after-resume"; command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; }
701 { event = "lock"; command = "${lib.getExe pkgs.gtklock} -d"; } 748 { event = "lock"; command = "${lockCommand} -d"; }
702 ]; 749 ];
703 timeouts = [ 750 timeouts = [
704 { timeout = 300; 751 { timeout = 300;
705 command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; 752 command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off";
706 resumeCommand = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; 753 resumeCommand = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on";
707 } 754 }
708 { timeout = 330; command = "${lib.getExe pkgs.gtklock} -d"; } 755 { timeout = 330; command = "${lockCommand} -d"; }
709 ]; 756 ];
710 extraArgs = [ 757 extraArgs = [
711 "idlehint" "30" 758 "idlehint" "30"
@@ -821,6 +868,9 @@ in {
821 }; 868 };
822 "gtklock/config.ini" = { 869 "gtklock/config.ini" = {
823 source = (pkgs.formats.ini {}).generate "config.ini" { 870 source = (pkgs.formats.ini {}).generate "config.ini" {
871 main = {
872
873 };
824 }; 874 };
825 }; 875 };
826 }; 876 };