From 2e6d7a2116bfb5d31d076189f2ea43b5ec9a52d8 Mon Sep 17 00:00:00 2001 From: Sarthak <118442597+sarthak1337-alt@users.noreply.github.com> Date: Fri, 4 Sep 2026 00:58:04 +0530 Subject: [PATCH] control centre: escape steps back to the main panel Submenus returned into a case that then fell out of the script, so escape closed everything. The panel now loops, and only escape on the main list (or an action that hands the screen to something else) closes it. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Cn3dHfbgNYdbZvzb1b3GQt --- .config/scripts/control-center.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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