dotfiles/sway/lock.sh
2025-02-15 21:46:53 +01:00

12 lines
322 B
Bash
Executable file

#!/bin/sh
LAPTOP_OUTPUT="LVDS-1"
LID_STATE_FILE="/proc/acpi/button/lid/LID0/state"
read -r LS < "$LID_STATE_FILE"
case "$LS" in
*open) swaymsg output "$LAPTOP_OUTPUT" enable ;;
*closed) swaylock -i ~/.wallpaper & swaymsg output "$LAPTOP_OUTPUT" disable ;;
*) echo "Could not get lid state" >&2 ; exit 1 ;;
esac