diff options
Diffstat (limited to 'accounts/gkleen@sif/systemd.nix')
-rw-r--r-- | accounts/gkleen@sif/systemd.nix | 144 |
1 files changed, 86 insertions, 58 deletions
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index 119d8cc3..a89b46c2 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix | |||
@@ -123,16 +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 | }; | 127 | BindsTo = [ "graphical-session.target" ]; |
128 | }; | ||
129 | dunst = { | ||
130 | Service = { | ||
131 | ExecStart = lib.mkForce "${cfg.services.dunst.package}/bin/dunst"; | ||
132 | Restart = "always"; | ||
133 | }; | ||
134 | Install = { | ||
135 | WantedBy = ["graphical-session.target"]; | ||
136 | }; | 128 | }; |
137 | }; | 129 | }; |
138 | keepassxc = { | 130 | keepassxc = { |
@@ -144,8 +136,8 @@ in { | |||
144 | Environment = [ "QT_QPA_PLATFORM=wayland" ]; | 136 | Environment = [ "QT_QPA_PLATFORM=wayland" ]; |
145 | }; | 137 | }; |
146 | Unit = { | 138 | Unit = { |
147 | Requires = ["graphical-session-pre.target"]; | 139 | After = [ "graphical-session.target" ]; |
148 | After = ["graphical-session-pre.target"]; | 140 | BindsTo = [ "graphical-session.target" ]; |
149 | }; | 141 | }; |
150 | }; | 142 | }; |
151 | mpris-proxy = { | 143 | mpris-proxy = { |
@@ -193,8 +185,8 @@ in { | |||
193 | WantedBy = ["graphical-session.target"]; | 185 | WantedBy = ["graphical-session.target"]; |
194 | }; | 186 | }; |
195 | Unit = { | 187 | Unit = { |
196 | Requires = ["graphical-session-pre.target"]; | 188 | After = [ "graphical-session.target" ]; |
197 | After = ["graphical-session-pre.target"]; | 189 | PartOf = [ "graphical-session.target" ]; |
198 | }; | 190 | }; |
199 | Service = { | 191 | Service = { |
200 | ExecStart = lib.getExe pkgs.psi-notify; | 192 | ExecStart = lib.getExe pkgs.psi-notify; |
@@ -207,6 +199,7 @@ in { | |||
207 | gtklock = { | 199 | gtklock = { |
208 | Unit = { | 200 | Unit = { |
209 | Requisite = ["graphical-session.target"]; | 201 | Requisite = ["graphical-session.target"]; |
202 | After = [ "graphical-session.target" ]; | ||
210 | PartOf = ["graphical-session.target"]; | 203 | PartOf = ["graphical-session.target"]; |
211 | }; | 204 | }; |
212 | Service = { | 205 | Service = { |
@@ -214,53 +207,55 @@ in { | |||
214 | RuntimeDirectory = "gtklock"; | 207 | RuntimeDirectory = "gtklock"; |
215 | CacheDirectory = "gtklock"; | 208 | CacheDirectory = "gtklock"; |
216 | ExecStartPre = [ | 209 | ExecStartPre = [ |
217 | "${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" |
218 | "${config.systemd.package}/bin/systemctl --user stop gpg-agent.service" | 211 | "-${lib.getExe' config.systemd.package "systemctl"} --user stop gpg-agent.service" |
219 | (pkgs.writeShellScript "generate-css" '' | 212 | "-${lib.getExe pkgs.playerctl} -a pause" |
220 | set -x | 213 | "-${lib.getExe (pkgs.writeShellApplication { |
221 | 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 | ||
222 | 231 | ||
223 | declare -A monitors | 232 | cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' |
224 | monitors=() | 233 | #window-box { |
225 | while IFS= read -r entry; do | 234 | padding: 64px; |
226 | path=$(jq -r ".path" <<<"$entry") | 235 | /* border: 1px solid black; */ |
227 | [[ -z "$path" || ! -f "$path" ]] && continue | 236 | border-radius: 4px; |
228 | blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}" | 237 | box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; |
229 | monitor=$(jq -r ".display" <<<"$entry") | 238 | /* background-color: white; */ |
230 | if [[ ! -f "$blurred_path" ]]; then | 239 | background-color: rgba(0, 0, 0, 0.5); |
231 | mkdir -p "$(dirname "$blurred_path")" | 240 | } |
232 | magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" & | 241 | ''} "$RUNTIME_DIRECTORY"/style.css |
233 | fi | 242 | for monitor in "''${!monitors[@]}"; do |
234 | monitors+=([$monitor]="$blurred_path") | 243 | cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF |
235 | done < <(wpaperctl all-wallpapers -j | jq -c ".[]") | 244 | window#''${monitor} { |
236 | wait | 245 | background-image: url("''${monitors[$monitor]}"); |
237 | 246 | background-repeat: no-repeat; | |
238 | cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' | 247 | background-size: 100% 100%; |
239 | #window-box { | 248 | background-origin: content-box; |
240 | padding: 64px; | ||
241 | /* border: 1px solid black; */ | ||
242 | border-radius: 4px; | ||
243 | box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; | ||
244 | /* background-color: white; */ | ||
245 | background-color: rgba(0, 0, 0, 0.5); | ||
246 | } | 249 | } |
247 | ''} "$RUNTIME_DIRECTORY"/style.css | 250 | EOF |
248 | for monitor in "''${!monitors[@]}"; do | 251 | done |
249 | cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF | 252 | ''; |
250 | window#''${monitor} { | 253 | })}" |
251 | background-image: url("''${monitors[$monitor]}"); | ||
252 | background-repeat: no-repeat; | ||
253 | background-size: 100% 100%; | ||
254 | background-origin: content-box; | ||
255 | } | ||
256 | EOF | ||
257 | done | ||
258 | '') | ||
259 | ]; | 254 | ]; |
260 | NotifyAccess = "all"; | 255 | NotifyAccess = "all"; |
261 | 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" '' |
262 | ${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off | 257 | ${lib.getExe cfg.programs.niri.package} msg action power-off-monitors |
263 | ${config.systemd.package}/bin/systemd-notify --ready | 258 | ${lib.getExe' config.systemd.package "systemd-notify"} --ready |
264 | ''}''; | 259 | ''}''; |
265 | }; | 260 | }; |
266 | }; | 261 | }; |
@@ -313,8 +308,8 @@ in { | |||
313 | WantedBy = ["graphical-session.target"]; | 308 | WantedBy = ["graphical-session.target"]; |
314 | }; | 309 | }; |
315 | Unit = { | 310 | Unit = { |
316 | BindsTo = ["graphical-session-pre.target"]; | 311 | After = [ "graphical-session.target" ]; |
317 | After = ["graphical-session-pre.target"]; | 312 | PartOf = [ "graphical-session.target" ]; |
318 | }; | 313 | }; |
319 | Service = { | 314 | Service = { |
320 | ExecStart = lib.getExe cfg.programs.wpaperd.package; | 315 | ExecStart = lib.getExe cfg.programs.wpaperd.package; |
@@ -323,6 +318,36 @@ in { | |||
323 | RestartSec = "2s"; | 318 | RestartSec = "2s"; |
324 | }; | 319 | }; |
325 | }; | 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 | }; | ||
326 | } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" { | 351 | } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" { |
327 | Unit = { | 352 | Unit = { |
328 | 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"]; |
@@ -373,6 +398,9 @@ in { | |||
373 | }; | 398 | }; |
374 | tray = { | 399 | tray = { |
375 | Unit = { | 400 | Unit = { |
401 | PartOf = [ "graphical-session.target" ]; | ||
402 | Requires = [ "waybar.service" ]; | ||
403 | After = [ "graphical-session.target" "waybar.service" ]; | ||
376 | Wants = ["blueman-applet.service" "udiskie.service" "network-manager-applet.service"]; | 404 | Wants = ["blueman-applet.service" "udiskie.service" "network-manager-applet.service"]; |
377 | }; | 405 | }; |
378 | }; | 406 | }; |