Files
dotfiles/home/kutu/scripts/power.sh
T

43 lines
1.1 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
opts=" Lock
󰒲 Suspend
 Shutdown
󰜉 Reboot
 Hibernate
 Stop KutuWM"
sel=$(printf "%s\n" "$opts" | dmenu -i -p "Select Power Option:" \
-nf '#e0af68' -nb '#1f2335' -sb '#f7768e' -sf '#1a1b26' -fn 'AgaveNerdFont-16')
[ -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 'AgaveNerdFont-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
;;
*Hibernate*)
confirm=$(printf "No\nYes" | dmenu -i -p "Are you sure you want to hibernate? :" \
-nf '#e0af68' -nb '#1f2335' -sb '#f7768e' -sf '#1a1b26' -fn 'AgaveNerdFont-16')
[ "$confirm" = "Yes" ] && exec systemctl --system hibernate
;;
*Stop\ KutuWM*)
exec kutu-run.rb stop
;;
*Suspend*)
exec systemctl --system suspend
;;
*Lock*)
~/dotfiles/scripts/lock.sh &
;;
esac