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

{
  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"
  '';
}