You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Declarative keyboard shortcuts with version protection](#keyboard-shortcuts)
15
16
16
17
## Installation
17
18
@@ -181,6 +182,7 @@ Check
181
182
-[bookmarks](#bookmarks)
182
183
-[spaces](#spaces)
183
184
-[pinned tabs](#pinned-tabs-pins)
185
+
-[keyboard shortcuts](#keyboard-shortcuts)
184
186
-[userChrome](#userchromecss)
185
187
186
188
### Extensions
@@ -528,6 +530,69 @@ You are also able to declare your pinned tabs! For more info, see
528
530
}
529
531
```
530
532
533
+
### Keyboard Shortcuts
534
+
535
+
Declarative overrides of Zen Browser's keyboard shortcuts with version protection against breaking changes.
536
+
537
+
```nix
538
+
{
539
+
programs.zen-browser.profiles.default = {
540
+
keyboardShortcuts = [
541
+
# Change compact mode toggle to Ctrl+Alt+S
542
+
{
543
+
id = "zen-compact-mode-toggle";
544
+
key = "s";
545
+
modifiers = {
546
+
control = true;
547
+
alt = true;
548
+
};
549
+
}
550
+
# Disable the quit shortcut to prevent accidental closes
551
+
{
552
+
id = "key_quitApplication";
553
+
disabled = true;
554
+
}
555
+
];
556
+
# Fails activation on schema changes to detect potential regressions
557
+
# Find this in about:config or prefs.js of your profile
558
+
keyboardShortcutsVersion = 14;
559
+
};
560
+
}
561
+
```
562
+
563
+
When you declare a shortcut override:
564
+
565
+
- Identity fields (`id`, `group`, `action`, `l10nId`, `reserved`, `internal`) are preserved from Zen's defaults
566
+
- Binding fields (`key`, `keycode`, `modifiers`, `disabled`) are completely replaced with your declaration
567
+
568
+
#### Configuration Options
569
+
570
+
-`profiles.*.keyboardShortcuts` (list of submodules): Declarative keyboard shortcuts configuration.
571
+
-`id` (string) **Required.** Unique identifier for the shortcut to modify.
572
+
-`key` (null or string) Character key (e.g., "a", "1", "+"). Leave null to use default.
573
+
-`keycode` (null or string) Virtual key code for special keys (e.g., "VK_F1", "VK_DELETE"). Leave null to use default.
574
+
-`disabled` (null or boolean) Set to true to disable the shortcut. Leave null to use default.
575
+
-`modifiers` (null or submodule) Modifier keys configuration. Leave null to use defaults.
576
+
-`control` (null or boolean) Ctrl key modifier.
577
+
-`alt` (null or boolean) Alt key modifier.
578
+
-`shift` (null or boolean) Shift key modifier.
579
+
-`meta` (null or boolean) Meta/Windows/Command key modifier.
580
+
-`accel` (null or boolean) Accelerator key (Ctrl on Linux/Windows, Cmd on macOS).
581
+
582
+
-`profiles.*.keyboardShortcutsVersion` (null or integer) Expected version of the keyboard shortcuts schema. If set, activation will fail if the Zen Browser shortcuts version doesn't match, preventing silent breakage after Zen Browser updates. Find the current version in `about:config` as `zen.keyboard.shortcuts.version`.
583
+
584
+
### Finding Shortcut IDs
585
+
586
+
Find all shortcuts in `~/.zen/<profile>/zen-keyboard-shortcuts.json`. For example:
Keyboard shortcuts are still managed by Zen and the home manager module only overrides them on activation. That means, that zen needs to be started at least once to create the shortcuts file if it doesn't exist yet. Then, every rebuild of your configuration (`nixos-rebuild switch` or `home-manager switch`) will apply your keybindings. Also note that you can just re-run activation scripts with `systemctl start home-manager-${USER}.service`.
0 commit comments