summaryrefslogtreecommitdiff
path: root/keyboard/shutdownprompt
blob: 71cac3dcc16737d567e52c584799aa7292f53cc8 (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