Open a new one with SUPER, go to the old one with SUPER+ALT
Making the plain application keys focus an existing window was the wrong call. It reads well in a demo and it is what macOS does, but it made "give me another terminal" the awkward case -- and on a tiling desktop a second terminal beside the first is the normal way to work, not an edge case. Reaching for the launcher to open a second file manager is not an improvement on anything. So the plain keys do what they always did, and SUPER+ALT is the new capability rather than a tax on the old one: go to the terminal, editor, browser, files, calculator or mail you already have, wherever it is, and start one only if there is none. ALT rather than SHIFT because SUPER+SHIFT is already the window-manipulation space -- Files, Neovim and Settings would have collided with Focus session, Taller and Shorter, and breaking two keys out of the eight-key resize set to make room is the worse trade. Also fixes a real trap found while using it. The Alt-Tab overlay commits on SUPER release, which is a compositor bind running an IPC call; if that call ever fails to land, the overlay stayed up with no keyboard focus, no Escape handler and nothing clickable, so the only way out was an IPC call typed into a terminal it was covering. Clicking outside now dismisses it, clicking a row switches to that window -- which is the obvious thing to try and did nothing -- and an abandoned switch closes itself after ten seconds. Keyboard focus still stays with the compositor, because taking it mid-switch is what would break stepping.
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Pressing the browser key twice should not give you two browsers.
|
||||
# Going to the window you already have, without giving up opening another.
|
||||
#
|
||||
# It is what the application keys do on macOS and Windows, and it was the
|
||||
# single most common "Linux feels wrong" moment this desktop still had. The
|
||||
# properties worth pinning:
|
||||
# SUPER opens a new one; SUPER+ALT goes to the one that exists. That order was
|
||||
# chosen after trying the reverse: making the plain key focus reads well in a
|
||||
# demo, but it makes "give me another terminal" the awkward case, and on a
|
||||
# tiling desktop a second terminal beside the first is the normal way to work
|
||||
# rather than an edge case.
|
||||
#
|
||||
# The properties worth pinning:
|
||||
#
|
||||
# 1. A window that is already open is focused, not duplicated.
|
||||
# 2. A window that is not open is launched.
|
||||
@@ -90,7 +94,7 @@ while read -r pattern; do
|
||||
[[ -n "$pattern" ]] || continue
|
||||
[[ "$pattern" == \^* ]] \
|
||||
|| note "the launch pattern '$pattern' is not anchored, so it can match an unrelated window"
|
||||
done < <(grep -oE "launch_or_focus\(\"[^\"]+\"" "$keybinds" | sed 's/launch_or_focus("//; s/"$//')
|
||||
done < <(grep -oE "go_to\(\"[^\"]+\"" "$keybinds" | sed 's/go_to("//; s/"$//')
|
||||
|
||||
# ── 4. Class plus title ─────────────────────────────────────────────────────
|
||||
|
||||
@@ -104,8 +108,20 @@ grep -q 'address:0xaaa' "$calls" \
|
||||
|
||||
# The editor bind must narrow by title, or it is indistinguishable from the
|
||||
# terminal bind.
|
||||
grep -q 'launch_or_focus("\^kitty\$", editor, "nvim")' "$keybinds" \
|
||||
|| note 'the editor bind does not narrow by title, so it would raise whatever terminal is open'
|
||||
grep -q 'go_to("\^kitty\$", editor, "nvim")' "$keybinds" \
|
||||
|| note 'the go-to-editor bind does not narrow by title, so it would raise whatever terminal is open'
|
||||
|
||||
# The plain application keys must still open a new window. This is the whole
|
||||
# point of the split, and the easiest thing to lose by accident.
|
||||
for app in terminal editor browser files calculator mail; do
|
||||
grep -qE "bind\(mod \.\. \" \+ [A-Z]\", hl\.dsp\.exec_cmd\($app\)" "$keybinds" \
|
||||
|| note "the plain $app key no longer opens a new window"
|
||||
done
|
||||
|
||||
# And every go-to bind is on SUPER+ALT, not somewhere that collides with the
|
||||
# window-manipulation space.
|
||||
count="$(grep -c 'bind(mod .. " + ALT + ' "$keybinds" || true)"
|
||||
(( count >= 6 )) || note "only $count go-to binds are on SUPER+ALT; there should be one per application key"
|
||||
|
||||
# ── The same dispatch bug must not come back elsewhere ──────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user