aboutsummaryrefslogtreecommitdiff
path: root/modules/home/i3wm/nord-blue/i3lock.nix
blob: 92ef450b2f8adfbe16aa286484b514bd52f346d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ pkgs }:

# Wrapper/script for i3-lock to use '~/Pictures/wallpaper.png' as the lock screen
{
  pkgs.writeShellScriptBin "lock-screen" ''
    #!/usr/bin/env sh
    set -eu

    WALL="''${1:-$HOME/Pictures/wallpaper.png}"
    TMP="/tmp/lockscreen.png"

    # Get current resolution (single-monitor friendly)
    RES=$(xrandr | awk '/\*/ {print $1; exit}')

    # Scale like feh --bg-fill
    magick "$WALL" \
      -resize "''${RES}^" \
      -gravity center \
      -extent "$RES" \
      "$TMP"

    i3lock -i "$TMP"
  '';
}