diff --git a/.config/scripts/control-center.sh b/.config/scripts/control-center.sh index 7929139..b66e562 100755 --- a/.config/scripts/control-center.sh +++ b/.config/scripts/control-center.sh @@ -8,6 +8,8 @@ set -uo pipefail RASI="$HOME/.config/rofi/control.rasi" +# 1 = close the panel entirely, 0 = fall back to the main list +CC_EXIT=0 menu() { # menu [rofi args...] local prompt="$1"; shift rofi -dmenu -i -theme "$RASI" -p "$prompt" "$@" @@ -212,6 +214,8 @@ power_menu() { "󰒲 Suspend" \ "󰜉 Reboot" \ "󰐥 Shut down" | menu "Power") + [ -z "$choice" ] && return # escape here goes back to the panel + CC_EXIT=1 case "$choice" in *Lock) lock_screen ;; *"Log out") bspc quit ;; @@ -256,6 +260,8 @@ shot_menu() { "󰩭 Region" \ "󰹑 Full screen" \ "󰆊 Region, delayed 3s" | menu "Screenshot") + [ -z "$choice" ] && return + CC_EXIT=1 case "$choice" in *Region) flameshot gui ;; *"Full screen") flameshot full -c -p "$HOME/pictures" 2>/dev/null || flameshot full -c ;; @@ -281,6 +287,7 @@ main_menu() { "󰠹 Particles $(particles_status)" \ "󰍹 Bar $(bar_status)" \ "󰐥 Power" | menu "Control") + [ -z "$choice" ] && { CC_EXIT=1; return; } case "$choice" in 󰖩*) wifi_menu ;; 󰂯*) bt_menu ;; @@ -290,8 +297,8 @@ main_menu() { 󰖂*) vpn_menu ;; 󰍺*) display_menu ;; 󰂚*) notif_menu ;; - 󰅍*) sh "$HOME/.config/scripts/rofi-menus/clipboard-manager.sh" ;; - 󰞅*) sh "$HOME/.config/scripts/rofi-menus/rofimoji.sh" ;; + 󰅍*) CC_EXIT=1; sh "$HOME/.config/scripts/rofi-menus/clipboard-manager.sh" ;; + 󰞅*) CC_EXIT=1; sh "$HOME/.config/scripts/rofi-menus/rofimoji.sh" ;; 󰹑*) shot_menu ;; 󰸉*) sh "$HOME/.config/scripts/set-wallpaper.sh" >/dev/null 2>&1 notify "Wallpaper" "Shuffled" ;; @@ -303,4 +310,6 @@ main_menu() { esac } -main_menu +while [ "$CC_EXIT" -eq 0 ]; do + main_menu +done