aboutsummaryrefslogtreecommitdiff
path: root/pkgs/theme/myswaylock.sh
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-02-21 21:54:09 +0100
committerKarel Kočí <cynerd@email.cz>2022-06-10 14:05:48 +0200
commit93b0545d11bf8c7f065203f7f3eaf1d0e3730dce (patch)
treeda93fa5fcd14c493d8ccd86c98f40d26c9697869 /pkgs/theme/myswaylock.sh
downloadnixos-personal-93b0545d11bf8c7f065203f7f3eaf1d0e3730dce.tar.gz
nixos-personal-93b0545d11bf8c7f065203f7f3eaf1d0e3730dce.tar.bz2
nixos-personal-93b0545d11bf8c7f065203f7f3eaf1d0e3730dce.zip
Add initial version
Diffstat (limited to 'pkgs/theme/myswaylock.sh')
-rwxr-xr-xpkgs/theme/myswaylock.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/theme/myswaylock.sh b/pkgs/theme/myswaylock.sh
new file mode 100755
index 0000000..c204a57
--- /dev/null
+++ b/pkgs/theme/myswaylock.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+# Switch to the US keyboard (to make sure that we have the correct one)
+swaymsg input type:keyboard xkb_layout us
+
+resolution="$(swaymsg -t get_outputs \
+ | jq -r '.[0].rect | [.width,.height] | join("x")')"
+case "$resolution" in
+ 1920x1080|2560x1440|2560x1600)
+ ;;
+ *)
+ resolution="1920x1080"
+ ;;
+esac
+
+exec swaylock -f \
+ -n -c 000000 \
+ -i "$(shuf -n1 -e "$BACKGROUND_LNXPCS"/*"$resolution.png")" \
+ -s fill