diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2022-11-28 07:45:30 -0600 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2022-11-28 07:45:30 -0600 |
commit | 4a38bb5e2b157dce33dd6a5058dece371a9e7161 (patch) | |
tree | 95097dd80b2e48afcbeeac494f1e97e1d4a578af /keyboard/shutdownprompt | |
parent | 521bc70d8a81334945a498c1ff09de45554c0fe9 (diff) | |
download | scripts-4a38bb5e2b157dce33dd6a5058dece371a9e7161.tar.xz scripts-4a38bb5e2b157dce33dd6a5058dece371a9e7161.zip |
asdf
Diffstat (limited to 'keyboard/shutdownprompt')
-rwxr-xr-x | keyboard/shutdownprompt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/keyboard/shutdownprompt b/keyboard/shutdownprompt index b56268d..7654f2f 100755 --- a/keyboard/shutdownprompt +++ b/keyboard/shutdownprompt @@ -1,6 +1,17 @@ #!/bin/sh dmenucolors='-nb #AA0000 -nf #FFF -sb #FF0000 -sf #FFF' [ -n "$1" ] && option="$1" || option=$(echo "Cancel\nSuspend\nShutdown\nRestart" | dmenu -p "Power Menu " $dmenucolors || exit) + +warn_process_names="ffmpeg obs 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 ;; |