Skip to content

Commit d11133f

Browse files
mswiszczclaude
andcommitted
feat: add Cmd+, settings shortcut, fix keybindings.json array validation
- Add app:settings keybinding (Cmd+,) to open settings block - Fix config editor rejecting keybindings.json save because it requires JSON objects — keybindings.json is an array by design. Added allowArray flag to ConfigFile type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 799855e commit d11133f

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

docs/docs/keybindings.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ You can also set `key` to `null` to unbind:
177177
| `app:openconnection` | <Kbd k="Cmd:g"/> | Open connection switcher |
178178
| `app:toggleaipanel` | <Kbd k="Cmd:Shift:a"/> | Toggle WaveAI panel |
179179
| `app:togglewidgetssidebar` | <Kbd k="Cmd:b"/> | Toggle widgets sidebar |
180+
| `app:settings` | <Kbd k="Cmd:,"/> | Open settings |
180181
| `term:togglemultiinput` | <Kbd k="Ctrl:Shift:i"/> | Toggle terminal multi-input |
181182
| `generic:cancel` | <Kbd k="Escape"/> | Close modals/search |
182183
| `block:splitchord` | <Kbd k="Ctrl:Shift:s"/> | Initiate split chord |

frontend/app/store/keymodel.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,16 @@ const defaultActions: ActionDef[] = [
795795
return true;
796796
},
797797
},
798+
{
799+
id: "app:settings",
800+
defaultKeys: ["Cmd:,"],
801+
handler: () => {
802+
fireAndForget(async () => {
803+
await createBlock({ meta: { view: "waveconfig" } }, false, true);
804+
});
805+
return true;
806+
},
807+
},
798808
// Numbered tab/block switch keys (1-9)
799809
...Array.from({ length: 9 }, (_, i) => {
800810
const idx = i + 1;

frontend/app/view/waveconfig/waveconfig-model.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export type ConfigFile = {
2727
validator?: ConfigValidator;
2828
isSecrets?: boolean;
2929
hasJsonView?: boolean;
30+
allowArray?: boolean;
3031
visualComponent?: React.ComponentType<{ model: WaveConfigViewModel }>;
3132
};
3233

@@ -70,6 +71,7 @@ function makeConfigFiles(isWindows: boolean): ConfigFile[] {
7071
language: "json",
7172
description: "Custom keyboard shortcuts",
7273
docsUrl: "https://docs.waveterm.dev/keybindings",
74+
allowArray: true,
7375
},
7476
{
7577
name: "Connections",
@@ -366,7 +368,12 @@ export class WaveConfigViewModel implements ViewModel {
366368
try {
367369
const parsed = JSON.parse(fileContent);
368370

369-
if (typeof parsed !== "object" || parsed == null || Array.isArray(parsed)) {
371+
if (selectedFile.allowArray) {
372+
if (!Array.isArray(parsed)) {
373+
globalStore.set(this.validationErrorAtom, "JSON must be an array");
374+
return;
375+
}
376+
} else if (typeof parsed !== "object" || parsed == null || Array.isArray(parsed)) {
370377
globalStore.set(this.validationErrorAtom, "JSON must be an object, not an array, primitive, or null");
371378
return;
372379
}

schema/keybindings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"block:switchto6", "block:switchto7", "block:switchto8", "block:switchto9", "block:switchtoai",
2828
"block:replacewithlauncher",
2929
"block:splitchord", "block:splitchordup", "block:splitchorddown", "block:splitchordleft", "block:splitchordright",
30-
"app:search", "app:openconnection", "app:toggleaipanel", "app:togglewidgetssidebar",
30+
"app:search", "app:openconnection", "app:toggleaipanel", "app:togglewidgetssidebar", "app:settings",
3131
"term:togglemultiinput",
3232
"generic:cancel",
3333
"-tab:new", "-tab:close", "-tab:prev", "-tab:next",
@@ -41,7 +41,7 @@
4141
"-block:switchto6", "-block:switchto7", "-block:switchto8", "-block:switchto9", "-block:switchtoai",
4242
"-block:replacewithlauncher",
4343
"-block:splitchord", "-block:splitchordup", "-block:splitchorddown", "-block:splitchordleft", "-block:splitchordright",
44-
"-app:search", "-app:openconnection", "-app:toggleaipanel", "-app:togglewidgetssidebar",
44+
"-app:search", "-app:openconnection", "-app:toggleaipanel", "-app:togglewidgetssidebar", "-app:settings",
4545
"-term:togglemultiinput",
4646
"-generic:cancel"
4747
]

0 commit comments

Comments
 (0)