aboutsummaryrefslogtreecommitdiff
path: root/modules/home/i3wm/nord-blue/i3lock.nix
blob: dc87766430391d138251bc3b9cc1238a6189e260 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{ 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"
''