From 250cb916526fd2da5cc735b2d3f2f3b909a66b47 Mon Sep 17 00:00:00 2001 From: Anjandev Momi Date: Sun, 11 Jul 2021 16:11:06 -0400 Subject: [PATCH] confirm logout, poweroff, and reboot Signed-off-by: Maarten van Gompel --- scripts/core/sxmo_appmenu.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index a8014f9..3b503bb 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -12,6 +12,16 @@ gracefulexit() { kill -9 0 } +confirm() { + PICKED="$(echo -e "Yes\nNo" | dmenu -l 16 -c -p "Confirm $1")" + + if [ "$PICKED" = "Yes" ]; then + return 0 + else + return 1 + fi +} + programchoicesinit() { XPROPOUT="$(xprop -id "$(xdotool getactivewindow)")" WMCLASS="${1:-$(echo "$XPROPOUT" | grep WM_CLASS | cut -d ' ' -f3- | tr '[:upper:]' '[:lower:]')}" @@ -174,9 +184,9 @@ programchoicesinit() { $icon_lck Lock ^ 0 ^ sxmo_screenlock.sh lock $icon_lck Lock (Screen off) ^ 0 ^ sxmo_screenlock.sh off $icon_zzz Suspend ^ 0 ^ sxmo_screenlock.sh lock && sxmo_screenlock.sh crust - $icon_out Logout ^ 0 ^ pkill -9 dwm - $icon_rld Reboot ^ 0 ^ sxmo_terminal.sh sudo reboot - $icon_pwr Poweroff ^ 0 ^ sxmo_terminal.sh sudo poweroff + $icon_out Logout ^ 0 ^ confirm Logout && pkill -9 dwm + $icon_rld Reboot ^ 0 ^ confirm Reboot && sxmo_terminal.sh sudo reboot + $icon_pwr Poweroff ^ 0 ^ confirm Poweroff && sxmo_terminal.sh sudo poweroff " WINNAME="Power" ;;