Scripts: lock the screen before suspending and hibernation

This commit is contained in:
Harzo 2023-06-18 15:51:54 +02:00
parent 8a4d5d9337
commit 3f72d5fb43
1 changed files with 14 additions and 9 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
option="$(printf "⏻ Shutdown\n Reboot\n Suspend\n Hibernate" | \ option="$(printf "󰍃 Log out\n⏻ Shutdown\n Reboot\n Suspend\n Hibernate" | \
wofi --dmenu -p "Session")" wofi --dmenu -p "Session")"
dialogue_box() { dialogue_box() {
@ -8,21 +8,26 @@ dialogue_box() {
--text="$1" --text="$1"
} }
dialogue_box "Are you sure?" || exit 0
case $option in case $option in
*Log\ out)
pkill -u $USER
;;
*Shutdown) *Shutdown)
dialogue_box "Are you sure you want to shutdown this computer?" && \ systemctl poweroff -i
systemctl poweroff -i
;; ;;
*Reboot) *Reboot)
dialogue_box "Are you sure you want to reboot this computer?" && \ systemctl reboot -i
systemctl reboot -i
;; ;;
*Suspend) *Suspend)
dialogue_box "Are you sure you want to suspend this computer?" && \ ~/.local/bin/scripts/system/screenlock &
systemctl suspend -i sleep 1
systemctl suspend -i
;; ;;
*Hibernate) *Hibernate)
dialogue_box "Are you sure you want to hibernate this computer?" && \ ~/.local/bin/scripts/system/screenlock &
systemctl hibernate -i sleep 1
systemctl hibernate -i
;; ;;
esac esac