feat: list the fixed app shortcuts in keyboard shortcuts

This commit is contained in:
LukeGus committed 2026-09-30 14:19:17 -05:00
1 parent 25cbd40283
commit 3c66931245
4 files changed
+79

No files matched your search

+12
View File
@@ -1514,6 +1514,18 @@
"title": "Keyboard Shortcuts",
"description": "Bind keys to actions in the terminal and the app, or change the built-in shortcuts.",
"defaultsHeading": "Built-in Shortcuts",
"fixedHeading": "App Shortcuts",
"fixed": {
"splitRight": "Split right",
"splitDown": "Split down",
"zoomPane": "Zoom the focused pane",
"navigatePane": "Move between panes",
"nextTab": "Next tab",
"previousTab": "Previous tab",
"jumpTab": "Jump to tab",
"previousView": "Back to the previous sidebar view",
"fullscreen": "Toggle fullscreen"
},
"customHeading": "Custom Shortcuts",
"addBinding": "Add Shortcut",
"addBindingTitle": "Add Shortcut",
+48
View File
@@ -0,0 +1,48 @@
import { useTranslation } from "react-i18next";
import { tabJumpHotkeyKeys } from "@/lib/tab-jump-hotkey";
/** Shortcuts the shell handles itself; they cannot be rebound. */
export function fixedShortcuts(): Array<{ keys: string[]; labelKey: string }> {
return [
{ keys: ["Ctrl", "Shift", "\\"], labelKey: "splitRight" },
{ keys: ["Ctrl", "Shift", "-"], labelKey: "splitDown" },
{ keys: ["Ctrl", "Shift", "Enter"], labelKey: "zoomPane" },
{ keys: ["Alt", "↑↓←→"], labelKey: "navigatePane" },
{ keys: ["Ctrl", "Shift", "]"], labelKey: "nextTab" },
{ keys: ["Ctrl", "Shift", "["], labelKey: "previousTab" },
{ keys: tabJumpHotkeyKeys(), labelKey: "jumpTab" },
{ keys: ["Ctrl", "Shift", "E"], labelKey: "previousView" },
{ keys: ["Ctrl", "Shift", "F"], labelKey: "fullscreen" },
];
}
export function FixedShortcutsList() {
const { t } = useTranslation();
return (
<div className="flex flex-col gap-1.5">
<span className="text-xs font-semibold text-muted-foreground">
{t("newUi.sidebar.keybindings.fixedHeading")}
</span>
{fixedShortcuts().map(({ keys, labelKey }) => (
<div
key={labelKey}
className="flex items-center justify-between gap-2 border border-border/60 px-2.5 py-1.5"
>
<span className="text-xs text-muted-foreground flex-1 min-w-0 truncate">
{t(`newUi.sidebar.keybindings.fixed.${labelKey}`)}
</span>
<div className="flex items-center gap-0.5 shrink-0">
{keys.map((key, index) => (
<kbd
key={index}
className="inline-flex items-center px-1 py-0.5 text-[10px] font-mono bg-muted border border-border/60 text-muted-foreground leading-none"
>
{key}
</kbd>
))}
</div>
</div>
))}
</div>
);
}
+2
View File
@@ -26,6 +26,7 @@ import {
import { Button } from "@/components/button";
import { Input } from "@/components/input";
import { Pencil, Plus, RotateCcw, Trash2 } from "lucide-react";
import { FixedShortcutsList } from "./FixedShortcutsList";
function formatCombo(combo: KeyCombo): string {
const parts: string[] = [];
@@ -395,6 +396,7 @@ export function KeybindingsDialog({
})
)}
</div>
<FixedShortcutsList />
</div>
<div className="flex items-center justify-between gap-2 mt-2">
@@ -0,0 +1,17 @@
import { describe, expect, it } from "vitest";
import { render, screen } from "@testing-library/react";
import {
FixedShortcutsList,
fixedShortcuts,
} from "@/sidebar/FixedShortcutsList";
describe("FixedShortcutsList", () => {
it("lists every shell shortcut with its keys", () => {
render(<FixedShortcutsList />);
expect(
screen.getByText("newUi.sidebar.keybindings.fixed.splitRight"),
).toBeTruthy();
expect(screen.getAllByText("Shift").length).toBeGreaterThan(3);
expect(fixedShortcuts().map((s) => s.labelKey)).toContain("jumpTab");
});
});