feat(cli): add scratchpad toggle and exclude scratch terminal from cycle

This commit is contained in:
Prad Nukala committed 2026-08-29 17:40:48 -04:00
1 parent a507b25c85
commit 4f9c36cb79
3 files changed
+448 -58

No files matched your search

+10 -5
View File
@@ -22,12 +22,16 @@ declare -A KITTY_CMDS=(
# --- Hyprland helpers --------------------------------------------------------
# Print the addresses of all windows whose class or initialClass matches the
# regex in $1. Windows are sorted by workspace, then by address, so the cycle
# order stays the same between calls.
# regex in $1. An optional regex in $2 excludes matches again — used to keep
# scratch windows out of a cycle. Windows are sorted by workspace, then by
# address, so the cycle order stays the same between calls.
addresses_matching() {
hyprctl clients -j | jq -r --arg re "$1" '
hyprctl clients -j | jq -r --arg re "$1" --arg not "${2:-}" '
[ .[]
| select(((.class // "") | test($re; "i")) or ((.initialClass // "") | test($re; "i")))
| select($not == "" or (
(((.class // "") | test($not; "i")) or ((.initialClass // "") | test($not; "i"))) | not
))
]
| sort_by(.workspace.id, .address)
| .[].address'
@@ -125,8 +129,9 @@ elif [[ $APP == "brave" ]]; then
DEFAULT_SPAWN="brave-origin-nightly"
elif [[ $APP == "terminal" ]]; then
# Cycle all terminals.
INSTANCES=($(addresses_matching '(kitty|alacritty|ghostty|foot|wezterm)'))
# Cycle all terminals. kitty-herdr is the SUPER + A scratch terminal
# (omarchy-toggle-scratch owns it), so it stays out of the rotation.
INSTANCES=($(addresses_matching '(kitty|alacritty|ghostty|foot|wezterm)' '^kitty-herdr$'))
DEFAULT_LAUNCHER="omarchy-launch-terminal"
elif [[ $APP == "ai" ]]; then