From ff5133843c26979f8abb5dd801b32f40287692fa Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 12 Aug 2022 16:32:15 +0200 Subject: [PATCH] zathura: add `mappings` option --- modules/programs/zathura.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/modules/programs/zathura.nix b/modules/programs/zathura.nix index 64a77cb3..769ec710 100644 --- a/modules/programs/zathura.nix +++ b/modules/programs/zathura.nix @@ -12,6 +12,8 @@ let if isBool v then (if v then "true" else "false") else toString v; in ''set ${n} "${formatValue v}"''; + formatMapLine = n: v: "map ${n} ${toString v}"; + in { meta.maintainers = [ maintainers.rprospero ]; @@ -45,6 +47,24 @@ in { }; }; + mappings = mkOption { + default = { }; + type = with types; attrsOf str; + description = '' + Add mappings to zathura and make + them permanent. See + + zathurarc + 5 + + for the full list of possible mappings. + ''; + example = { + D = "toggle_page_mode"; + "" = "navigate next"; + }; + }; + extraConfig = mkOption { type = types.lines; default = ""; @@ -60,6 +80,7 @@ in { xdg.configFile."zathura/zathurarc".text = concatStringsSep "\n" ([ ] ++ optional (cfg.extraConfig != "") cfg.extraConfig - ++ mapAttrsToList formatLine cfg.options) + "\n"; + ++ mapAttrsToList formatLine cfg.options + ++ mapAttrsToList formatMapLine cfg.mappings) + "\n"; }; }