Files
kutu/src/shell/power.sh
2025-10-29 18:17:59 +00:00

35 lines
894 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
opts="
󰒲 Suspend
 Stop KutuWM
 Shutdown
󰜉 Reboot"
sel=$(printf "%s\n" "$opts" | dmenu -i -p "Select Power Option:" \
-nf '#e0af68' -nb '#1f2335' -sb '#f7768e' -sf '#1a1b26' -fn 'HurmitNerdFont-16')
# user pressed Esc
[ -z "$sel" ] && exit 0
case "$sel" in
*Shutdown*)
confirm=$(printf "No\nYes" | dmenu -i -p "Are you sure you want to shutdown? :" \
-nf '#e0af68' -nb '#1f2335' -sb '#f7768e' -sf '#1a1b26' -fn 'HurmitNerdFont-16')
[ "$confirm" = "Yes" ] && exec shutdown -h now
;;
*Reboot*)
confirm=$(printf "No\nYes" | dmenu -i -p "Are you sure you want to reboot? :" \
-nf '#e0af68' -nb '#1f2335' -sb '#f7768e' -sf '#1a1b26' -fn 'HurmitNerdFont-16')
[ "$confirm" = "Yes" ] && exec reboot
;;
*Stop\ KutuWM*)
exec kutu-run.rb stop
;;
*Suspend*)
~/dotfiles/scripts/lock.sh &
exec systemctl suspend
;;
esac