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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cn3dHfbgNYdbZvzb1b3GQt
This commit is contained in:
Sarthak 2026-09-04 00:58:04 +05:30
parent 7b4f562d50
commit 2e6d7a2116

View file

@ -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 <prompt> [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