1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

qutebrowser: actually implement unbinding

The documentation for the option says...

> If you want a default binding to be passed through to the website,
> bind it to null.

but if you actually try to set a key to `null`, it causes an error.

> A definition for option
> `programs.qutebrowser.keyBindings."<Ctrl+Shift+Tab>".normal' is not
> of type `strings concatenated with " ;; "'.

So this commit implements unbinding as it is documented.
This commit is contained in:
Kylie McClain 2024-01-18 12:13:01 -05:00 committed by Robert Helgesson
parent 35536fc6d6
commit 096d9c04b3
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
2 changed files with 8 additions and 3 deletions

View file

@ -9,7 +9,7 @@ let
formatLine = o: n: v:
let
formatValue = v:
if builtins.isNull v then
if v == null then
"None"
else if builtins.isBool v then
(if v then "True" else "False")
@ -29,7 +29,10 @@ let
formatKeyBindings = m: b:
let
formatKeyBinding = m: k: c:
''config.bind("${k}", "${escape [ ''"'' ] c}", mode="${m}")'';
if c == null then
''config.unbind("${k}", mode="${m}")''
else
''config.bind("${k}", "${escape [ ''"'' ] c}", mode="${m}")'';
in concatStringsSep "\n" (mapAttrsToList (formatKeyBinding m) b);
formatQuickmarks = n: s: "${n} ${s}";
@ -131,7 +134,7 @@ in {
};
keyBindings = mkOption {
type = with types; attrsOf (attrsOf (separatedString " ;; "));
type = with types; attrsOf (attrsOf (nullOr (separatedString " ;; ")));
default = { };
description = ''
Key bindings mapping keys to commands in different modes. This setting

View file

@ -8,6 +8,7 @@
keyBindings = {
normal = {
":" = null;
"<Ctrl-v>" = "spawn mpv {url}";
",l" = ''config-cycle spellcheck.languages ["en-GB"] ["en-US"]'';
"<F1>" = lib.mkMerge [
@ -35,6 +36,7 @@
config.load_autoconfig(False)
c.bindings.default = {}
config.bind(",l", "config-cycle spellcheck.languages [\"en-GB\"] [\"en-US\"]", mode="normal")
config.unbind(":", mode="normal")
config.bind("<Ctrl-v>", "spawn mpv {url}", mode="normal")
config.bind("<F1>", "config-cycle tabs.show never always ;; config-cycle statusbar.show in-mode always ;; config-cycle scrolling.bar never always", mode="normal")
config.bind("<Ctrl-y>", "prompt-yes", mode="prompt")''