feat(app): make the New tab launcher keyboard-first

Cmd/Ctrl+T now opens the focused pane's launcher, while explicit target shortcuts bypass the menu. Dispatcher ownership is scoped to the app tree so retained workspaces cannot intercept commands.
This commit is contained in:
Mohamed Boudra
2026-08-17 21:15:16 +02:00
parent 8655722296
commit 60bafad3ee
38 changed files with 1047 additions and 168 deletions
@@ -8,9 +8,9 @@ describe("formatShortcut", () => {
expect(formatShortcut(["mod", "E"], "mac")).toBe("⌘E");
});
it("spells out Shift in shortcut labels", () => {
expect(formatShortcut(["shift", "Tab"], "mac")).toBe("Shift+Tab");
expect(formatShortcut(["mod", "shift", "P"], "mac")).toBe("Shift+⌘+P");
it("uses the Shift symbol on macOS and spells it out elsewhere", () => {
expect(formatShortcut(["shift", "Tab"], "mac")).toBe("⇧Tab");
expect(formatShortcut(["mod", "shift", "P"], "mac")).toBe("⇧⌘P");
expect(formatShortcut(["shift", "Tab"], "non-mac")).toBe("Shift+Tab");
});
+2 -6
View File
@@ -27,22 +27,18 @@ export function formatShortcut(keys: ShortcutKey[], os: ShortcutOs): string {
const order = ["ctrl", "alt", "shift", "mod", "meta"];
const symbols: Record<string, string> = {
mod: "⌘",
shift: "⇧",
alt: "⌥",
ctrl: "⌃",
meta: "⌘",
};
const modifierSet = new Set(normalized);
const mods = order
.filter((k) => modifierSet.has(k))
.map((k) => (k === "shift" ? "Shift" : (symbols[k] ?? "")));
const mods = order.filter((k) => modifierSet.has(k)).map((k) => symbols[k] ?? "");
const main = normalized
.filter((k) => !order.includes(k))
.map(normalizeKey)
.join("");
if (mods.includes("Shift")) {
return [...mods, main].filter(Boolean).join("+");
}
return `${mods.join("")}${main}`;
}