From 7fa29ba27f9a972a12038ec5b6ed77665bc8e159 Mon Sep 17 00:00:00 2001 From: aristote Date: Fri, 3 May 2024 14:27:25 +0200 Subject: pkgs: lockscreen: tile image --- pkgs/lockscreen/default.nix | 70 +++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 28 deletions(-) (limited to 'pkgs') diff --git a/pkgs/lockscreen/default.nix b/pkgs/lockscreen/default.nix index dd68b79..500e856 100644 --- a/pkgs/lockscreen/default.nix +++ b/pkgs/lockscreen/default.nix @@ -1,28 +1,42 @@ -{ runCommand, imagemagick, i3lock-color, lib, backgroundImage ? null, resolution ? "1920x1080" }: - -let useBackgroundImage = backgroundImage != null; -in runCommand "lockscreen" { envVariable = true; } ('' - mkdir -p $out/{bin,share} -'' + (lib.optionalString useBackgroundImage '' - ${imagemagick}/bin/convert ${backgroundImage} -resize ${resolution} -blur 0x5 RGB:$out/share/lockscreen.png -'') + '' - echo > $out/bin/lockscreen.sh \ - "export PATH=$PATH - ${i3lock-color}/bin/i3lock-color \\ - '' + (lib.optionalString useBackgroundImage '' - --raw ${resolution}:rgb \\ - --image $out/share/lockscreen.png \\ - '') + '' - --no-unlock-indicator \\ - --composite \\ - --clock \\ - --ignore-empty-password \\ - --time-color=FFFFFFFF \\ - --date-color=00000000 \\ - --time-size=100" - '' + (lib.optionalString useBackgroundImage '' - chmod 444 $out/share/lockscreen.png - '') + '' - chmod 555 $out/bin/lockscreen.sh - chmod 555 $out/{bin,share} - '') +{ + runCommand, + imagemagick, + i3lock-color, + lib, + backgroundImage ? null, + resolution ? "1920x1080", +}: let + useBackgroundImage = backgroundImage != null; +in + runCommand "lockscreen" {envVariable = true;} ('' + mkdir -p $out/{bin,share} + '' + + (lib.optionalString useBackgroundImage '' + ${imagemagick}/bin/convert ${backgroundImage} -resize ${resolution} -blur 0x5 RGB:$out/share/lockscreen.png + '') + + '' + echo > $out/bin/lockscreen.sh \ + "export PATH=$PATH + ${i3lock-color}/bin/i3lock-color \\ + '' + + (lib.optionalString useBackgroundImage '' + --raw ${resolution}:rgb \\ + --image $out/share/lockscreen.png \\ + --tiling \\ + '') + + '' + --no-unlock-indicator \\ + --composite \\ + --clock \\ + --ignore-empty-password \\ + --time-color=FFFFFFFF \\ + --date-color=00000000 \\ + --time-size=100" + '' + + (lib.optionalString useBackgroundImage '' + chmod 444 $out/share/lockscreen.png + '') + + '' + chmod 555 $out/bin/lockscreen.sh + chmod 555 $out/{bin,share} + '') -- cgit v1.2.3