Toggle existing omarchy menu if already open

This commit is contained in:
David Heinemeier Hansson
2026-03-05 14:16:50 -04:00
parent d3285f6b00
commit b50ec21442
+9
View File
@@ -19,6 +19,13 @@ back_to() {
fi fi
} }
toggle_existing_menu() {
if pgrep -f "walker.*--dmenu" > /dev/null; then
walker --close > /dev/null 2>&1
exit 0
fi
}
menu() { menu() {
local prompt="$1" local prompt="$1"
local options="$2" local options="$2"
@@ -619,6 +626,8 @@ go_to_menu() {
USER_EXTENSIONS="$HOME/.config/omarchy/extensions/menu.sh" USER_EXTENSIONS="$HOME/.config/omarchy/extensions/menu.sh"
[[ -f $USER_EXTENSIONS ]] && source "$USER_EXTENSIONS" [[ -f $USER_EXTENSIONS ]] && source "$USER_EXTENSIONS"
toggle_existing_menu
if [[ -n $1 ]]; then if [[ -n $1 ]]; then
BACK_TO_EXIT=true BACK_TO_EXIT=true
go_to_menu "$1" go_to_menu "$1"