diff options
Diffstat (limited to 'accounts/gkleen@sif/systemd.nix')
| -rw-r--r-- | accounts/gkleen@sif/systemd.nix | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index c21514ea..7aee29c5 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix | |||
| @@ -239,69 +239,6 @@ in { | |||
| 239 | WatchdogSec = "2s"; | 239 | WatchdogSec = "2s"; |
| 240 | }; | 240 | }; |
| 241 | }; | 241 | }; |
| 242 | gtklock = { | ||
| 243 | Unit = { | ||
| 244 | Requisite = ["graphical-session.target"]; | ||
| 245 | After = [ "graphical-session.target" ]; | ||
| 246 | PartOf = ["graphical-session.target"]; | ||
| 247 | }; | ||
| 248 | Service = { | ||
| 249 | Type = "notify"; | ||
| 250 | RuntimeDirectory = "gtklock"; | ||
| 251 | CacheDirectory = "gtklock"; | ||
| 252 | ExecStartPre = [ | ||
| 253 | "-${lib.getExe' pkgs.libsForQt5.qt5.qttools.bin "qdbus"} org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases" | ||
| 254 | "-${lib.getExe' config.systemd.package "systemctl"} --user stop gpg-agent.service" | ||
| 255 | "-${lib.getExe pkgs.playerctl} -a pause" | ||
| 256 | "-${lib.getExe (pkgs.writeShellApplication { | ||
| 257 | name = "generate-css"; | ||
| 258 | runtimeInputs = with pkgs; [cfg.services.wpaperd.package jq coreutils imagemagick findutils]; | ||
| 259 | text = '' | ||
| 260 | declare -A monitors | ||
| 261 | monitors=() | ||
| 262 | while IFS= read -r entry; do | ||
| 263 | path=$(jq -r ".path" <<<"$entry") | ||
| 264 | [[ -z "$path" || ! -f "$path" ]] && continue | ||
| 265 | blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}" | ||
| 266 | monitor=$(jq -r ".display" <<<"$entry") | ||
| 267 | if [[ ! -f "$blurred_path" ]]; then | ||
| 268 | mkdir -p "$(dirname "$blurred_path")" | ||
| 269 | magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" & | ||
| 270 | fi | ||
| 271 | monitors+=([$monitor]="$blurred_path") | ||
| 272 | done < <(wpaperctl all-wallpapers -j | jq -c ".[]") | ||
| 273 | # wait | ||
| 274 | |||
| 275 | cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' | ||
| 276 | #window-box { | ||
| 277 | padding: 64px; | ||
| 278 | /* border: 1px solid black; */ | ||
| 279 | border-radius: 4px; | ||
| 280 | box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; | ||
| 281 | /* background-color: white; */ | ||
| 282 | background-color: rgba(0, 0, 0, 0.5); | ||
| 283 | } | ||
| 284 | ''} "$RUNTIME_DIRECTORY"/style.css | ||
| 285 | for monitor in "''${!monitors[@]}"; do | ||
| 286 | cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF | ||
| 287 | window#''${monitor} { | ||
| 288 | background-image: url("''${monitors[$monitor]}"); | ||
| 289 | background-repeat: no-repeat; | ||
| 290 | background-size: 100% 100%; | ||
| 291 | background-origin: content-box; | ||
| 292 | } | ||
| 293 | EOF | ||
| 294 | done | ||
| 295 | ''; | ||
| 296 | })}" | ||
| 297 | ]; | ||
| 298 | NotifyAccess = "all"; | ||
| 299 | ExecStart = ''${lib.getExe pkgs.gtklock} -s "''${RUNTIME_DIRECTORY}/style.css" -L ${pkgs.writeShellScript "after-lock" '' | ||
| 300 | ${lib.getExe cfg.programs.niri.package} msg action power-off-monitors | ||
| 301 | ${lib.getExe' config.systemd.package "systemd-notify"} --ready | ||
| 302 | ''}''; | ||
| 303 | }; | ||
| 304 | }; | ||
| 305 | "yt-dlp@" = { | 242 | "yt-dlp@" = { |
| 306 | Service = { | 243 | Service = { |
| 307 | Type = "notify"; | 244 | Type = "notify"; |
