diff options
Diffstat (limited to 'accounts/gkleen@sif/systemd.nix')
-rw-r--r-- | accounts/gkleen@sif/systemd.nix | 135 |
1 files changed, 86 insertions, 49 deletions
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index cefcf4ea..a89b46c2 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix | |||
@@ -123,7 +123,8 @@ in { | |||
123 | }; | 123 | }; |
124 | emacs = { | 124 | emacs = { |
125 | Unit = { | 125 | Unit = { |
126 | After = ["graphical-session-pre.target"]; | 126 | After = [ "graphical-session.target" ]; |
127 | BindsTo = [ "graphical-session.target" ]; | ||
127 | }; | 128 | }; |
128 | }; | 129 | }; |
129 | keepassxc = { | 130 | keepassxc = { |
@@ -135,8 +136,8 @@ in { | |||
135 | Environment = [ "QT_QPA_PLATFORM=wayland" ]; | 136 | Environment = [ "QT_QPA_PLATFORM=wayland" ]; |
136 | }; | 137 | }; |
137 | Unit = { | 138 | Unit = { |
138 | Requires = ["graphical-session-pre.target"]; | 139 | After = [ "graphical-session.target" ]; |
139 | After = ["graphical-session-pre.target"]; | 140 | BindsTo = [ "graphical-session.target" ]; |
140 | }; | 141 | }; |
141 | }; | 142 | }; |
142 | mpris-proxy = { | 143 | mpris-proxy = { |
@@ -184,8 +185,8 @@ in { | |||
184 | WantedBy = ["graphical-session.target"]; | 185 | WantedBy = ["graphical-session.target"]; |
185 | }; | 186 | }; |
186 | Unit = { | 187 | Unit = { |
187 | Requires = ["graphical-session-pre.target"]; | 188 | After = [ "graphical-session.target" ]; |
188 | After = ["graphical-session-pre.target"]; | 189 | PartOf = [ "graphical-session.target" ]; |
189 | }; | 190 | }; |
190 | Service = { | 191 | Service = { |
191 | ExecStart = lib.getExe pkgs.psi-notify; | 192 | ExecStart = lib.getExe pkgs.psi-notify; |
@@ -198,6 +199,7 @@ in { | |||
198 | gtklock = { | 199 | gtklock = { |
199 | Unit = { | 200 | Unit = { |
200 | Requisite = ["graphical-session.target"]; | 201 | Requisite = ["graphical-session.target"]; |
202 | After = [ "graphical-session.target" ]; | ||
201 | PartOf = ["graphical-session.target"]; | 203 | PartOf = ["graphical-session.target"]; |
202 | }; | 204 | }; |
203 | Service = { | 205 | Service = { |
@@ -205,53 +207,55 @@ in { | |||
205 | RuntimeDirectory = "gtklock"; | 207 | RuntimeDirectory = "gtklock"; |
206 | CacheDirectory = "gtklock"; | 208 | CacheDirectory = "gtklock"; |
207 | ExecStartPre = [ | 209 | ExecStartPre = [ |
208 | "${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" |
209 | "${config.systemd.package}/bin/systemctl --user stop gpg-agent.service" | 211 | "-${lib.getExe' config.systemd.package "systemctl"} --user stop gpg-agent.service" |
210 | (pkgs.writeShellScript "generate-css" '' | 212 | "-${lib.getExe pkgs.playerctl} -a pause" |
211 | set -x | 213 | "-${lib.getExe (pkgs.writeShellApplication { |
212 | 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 | ||
213 | 231 | ||
214 | declare -A monitors | 232 | cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' |
215 | monitors=() | 233 | #window-box { |
216 | while IFS= read -r entry; do | 234 | padding: 64px; |
217 | path=$(jq -r ".path" <<<"$entry") | 235 | /* border: 1px solid black; */ |
218 | [[ -z "$path" || ! -f "$path" ]] && continue | 236 | border-radius: 4px; |
219 | blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}" | 237 | box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; |
220 | monitor=$(jq -r ".display" <<<"$entry") | 238 | /* background-color: white; */ |
221 | if [[ ! -f "$blurred_path" ]]; then | 239 | background-color: rgba(0, 0, 0, 0.5); |
222 | mkdir -p "$(dirname "$blurred_path")" | 240 | } |
223 | magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" & | 241 | ''} "$RUNTIME_DIRECTORY"/style.css |
224 | fi | 242 | for monitor in "''${!monitors[@]}"; do |
225 | monitors+=([$monitor]="$blurred_path") | 243 | cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF |
226 | done < <(wpaperctl all-wallpapers -j | jq -c ".[]") | 244 | window#''${monitor} { |
227 | wait | 245 | background-image: url("''${monitors[$monitor]}"); |
228 | 246 | background-repeat: no-repeat; | |
229 | cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' | 247 | background-size: 100% 100%; |
230 | #window-box { | 248 | background-origin: content-box; |
231 | padding: 64px; | ||
232 | /* border: 1px solid black; */ | ||
233 | border-radius: 4px; | ||
234 | box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; | ||
235 | /* background-color: white; */ | ||
236 | background-color: rgba(0, 0, 0, 0.5); | ||
237 | } | 249 | } |
238 | ''} "$RUNTIME_DIRECTORY"/style.css | 250 | EOF |
239 | for monitor in "''${!monitors[@]}"; do | 251 | done |
240 | cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF | 252 | ''; |
241 | window#''${monitor} { | 253 | })}" |
242 | background-image: url("''${monitors[$monitor]}"); | ||
243 | background-repeat: no-repeat; | ||
244 | background-size: 100% 100%; | ||
245 | background-origin: content-box; | ||
246 | } | ||
247 | EOF | ||
248 | done | ||
249 | '') | ||
250 | ]; | 254 | ]; |
251 | NotifyAccess = "all"; | 255 | NotifyAccess = "all"; |
252 | 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" '' |
253 | ${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off | 257 | ${lib.getExe cfg.programs.niri.package} msg action power-off-monitors |
254 | ${config.systemd.package}/bin/systemd-notify --ready | 258 | ${lib.getExe' config.systemd.package "systemd-notify"} --ready |
255 | ''}''; | 259 | ''}''; |
256 | }; | 260 | }; |
257 | }; | 261 | }; |
@@ -304,8 +308,8 @@ in { | |||
304 | WantedBy = ["graphical-session.target"]; | 308 | WantedBy = ["graphical-session.target"]; |
305 | }; | 309 | }; |
306 | Unit = { | 310 | Unit = { |
307 | BindsTo = ["graphical-session-pre.target"]; | 311 | After = [ "graphical-session.target" ]; |
308 | After = ["graphical-session-pre.target"]; | 312 | PartOf = [ "graphical-session.target" ]; |
309 | }; | 313 | }; |
310 | Service = { | 314 | Service = { |
311 | ExecStart = lib.getExe cfg.programs.wpaperd.package; | 315 | ExecStart = lib.getExe cfg.programs.wpaperd.package; |
@@ -314,6 +318,36 @@ in { | |||
314 | RestartSec = "2s"; | 318 | RestartSec = "2s"; |
315 | }; | 319 | }; |
316 | }; | 320 | }; |
321 | xembed-sni-proxy = { | ||
322 | Unit = { | ||
323 | PartOf = lib.mkForce ["tray.target"]; | ||
324 | BindsTo = ["xwayland-satellite.service"]; | ||
325 | After = ["xwayland-satellite.service"]; | ||
326 | }; | ||
327 | }; | ||
328 | poweralertd = { | ||
329 | Unit = { | ||
330 | After = ["graphical-session.target"]; | ||
331 | }; | ||
332 | }; | ||
333 | network-manager-applet = { | ||
334 | Unit = { | ||
335 | PartOf = lib.mkForce ["tray.target"]; | ||
336 | }; | ||
337 | }; | ||
338 | udiskie = { | ||
339 | Unit = { | ||
340 | PartOf = lib.mkForce ["tray.target"]; | ||
341 | }; | ||
342 | }; | ||
343 | blueman-applet = { | ||
344 | Unit = { | ||
345 | PartOf = lib.mkForce ["tray.target"]; | ||
346 | }; | ||
347 | Install = { | ||
348 | WantedBy = lib.mkForce ["tray.target"]; | ||
349 | }; | ||
350 | }; | ||
317 | } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" { | 351 | } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" { |
318 | Unit = { | 352 | Unit = { |
319 | Requires = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"]; | 353 | Requires = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"]; |
@@ -364,6 +398,9 @@ in { | |||
364 | }; | 398 | }; |
365 | tray = { | 399 | tray = { |
366 | Unit = { | 400 | Unit = { |
401 | PartOf = [ "graphical-session.target" ]; | ||
402 | Requires = [ "waybar.service" ]; | ||
403 | After = [ "graphical-session.target" "waybar.service" ]; | ||
367 | Wants = ["blueman-applet.service" "udiskie.service" "network-manager-applet.service"]; | 404 | Wants = ["blueman-applet.service" "udiskie.service" "network-manager-applet.service"]; |
368 | }; | 405 | }; |
369 | }; | 406 | }; |