diff --git a/lib/helpers.nix b/lib/helpers.nix index 87f4f5cb..3b9618ed 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -55,7 +55,13 @@ with lib; rec { nowait = false; action = action; } - else action) + else { + inherit (action) silent expr unique noremap script nowait; + action = + if action.lua + then mkRaw action.action + else action; + }) maps; in builtins.attrValues (builtins.mapAttrs diff --git a/modules/keymaps.nix b/modules/keymaps.nix index c95e0fed..ea989f5e 100644 --- a/modules/keymaps.nix +++ b/modules/keymaps.nix @@ -51,11 +51,18 @@ with lib; let description = "The action to execute."; }; - description = mkOption { - type = types.nullOr types.str; - description = "A textual description of this keybind, to be shown in which-key, if you have it."; - default = null; + lua = mkOption { + type = types.bool; + description = '' + If true, `action` is considered to be lua code. + Thus, it will not be wrapped in `""`. + ''; + default = false; }; + + description = helpers.mkNullOrOption types.str '' + A textual description of this keybind, to be shown in which-key, if you have it. + ''; }; }) ];