blob: ce187a8662130d310ce9b4e412ef8caa234be760 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!/bin/sh
dmenucolors='-nb #AA0000 -nf #FFF -sb #FF0000 -sf #FFF'
[ -n "$1" ] && option="$1" || option=$(printf "Cancel\nSuspend\nShutdown\nRestart" | dmenu -p "Power Menu " $dmenucolors || exit)
warn_process_names="ffmpeg obs dvgrab dnf xbps-install xbps-remove emerge apt pacman"
for process_name in $warn_process_names; do
if pgrep $process_name >/dev/null; then
cancel=$(echo "Cancel\nProceed" | dmenu -p "Are you sure you want to shut down while $process_name is still running?" $dmenucolors)
[ "$cancel" = "Proceed" ] && continue
exit
fi
done
case $option in
Suspend) launch zzz ;;
Shutdown) launch off ;;
Restart) launch res ;;
esac
|