diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b5668e0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +hypr/menu-*.list diff --git a/hypr/scripts/launch-menu.sh b/hypr/scripts/launch-menu.sh index 8c21518..d32c9a4 100755 --- a/hypr/scripts/launch-menu.sh +++ b/hypr/scripts/launch-menu.sh @@ -1,13 +1,22 @@ #!/usr/bin/env bash -SCRIPTS="$HOME/.config/hypr/menu.list" +BASE_MENU="$HOME/.config/hypr/menu.list" +HOST_MENU="$HOME/.config/hypr/menu-$(hostname).list" HISTORY_FILE="$HOME/.cache/tofi/launch-menu.txt" -# Kill existing tofi instance if running +# Build effective menu (host-specific overrides public) +MENU_CONTENT=$(cat "$BASE_MENU" 2>/dev/null) +[ -f "$HOST_MENU" ] && MENU_CONTENT=$(cat "$BASE_MENU" "$HOST_MENU") + pkill -x tofi || { - chosen=$(cut -d'=' -f1 "$SCRIPTS" | tofi --history-file="$HISTORY_FILE" --history=true --require-match=true --fuzzy-match=true) + chosen=$(printf '%s\n' "$MENU_CONTENT" \ + | cut -d'=' -f1 \ + | tofi --history-file="$HISTORY_FILE" --history=true --require-match=true --fuzzy-match=true) + if [ -n "$chosen" ]; then - script=$(awk -F= -v sel="$chosen" '$1==sel {print $2}' "$SCRIPTS") + script=$(printf '%s\n' "$MENU_CONTENT" \ + | awk -F= -v sel="$chosen" '$1==sel {print $2}' \ + | tail -n1) [ -n "$script" ] && eval "$script" & fi }