1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-24 02:39:48 +01:00

sway: add option config.bindkeysToCode

Do not use `--to-code` by default in `bindsym`.

PR #1289
This commit is contained in:
Roman Volosatovs 2020-05-30 13:58:05 +02:00 committed by Robert Helgesson
parent 0ee5c9536b
commit 85748171ec
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 18 additions and 5 deletions

View file

@ -180,7 +180,7 @@ let
client.placeholder ${colorSetStr colors.placeholder}
client.background ${colors.background}
${keybindingsStr keybindings}
${keybindingsStr { inherit keybindings; }}
${keycodebindingsStr keycodebindings}
${concatStringsSep "\n" (mapAttrsToList modeStr modes)}
${concatStringsSep "\n" (mapAttrsToList assignStr assigns)}

View file

@ -8,10 +8,10 @@ rec {
concatStringsSep " " (mapAttrsToList (k: v: ''${k}="${v}"'') criteria)
}]";
keybindingsStr = keybindings:
keybindingsStr = { keybindings, bindsymArgs ? "" }:
concatStringsSep "\n" (mapAttrsToList (keycomb: action:
optionalString (action != null) "bindsym ${
lib.optionalString (moduleName == "sway") "--to-code "
lib.optionalString (bindsymArgs != "") "${bindsymArgs} "
}${keycomb} ${action}") keybindings);
keycodebindingsStr = keycodebindings:
@ -31,7 +31,7 @@ rec {
modeStr = name: keybindings: ''
mode "${name}" {
${keybindingsStr keybindings}
${keybindingsStr { inherit keybindings; }}
}
'';

View file

@ -139,6 +139,15 @@ let
'';
};
bindkeysToCode = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Whether to make use of <option>--to-code</option> in keybindings.
'';
};
input = mkOption {
type = types.attrsOf (types.attrsOf types.str);
default = { };
@ -259,7 +268,11 @@ let
client.placeholder ${colorSetStr colors.placeholder}
client.background ${colors.background}
${keybindingsStr keybindings}
${keybindingsStr {
inherit keybindings;
bindsymArgs =
lib.optionalString (cfg.config.bindkeysToCode) "--to-code";
}}
${keycodebindingsStr keycodebindings}
${concatStringsSep "\n" (mapAttrsToList inputStr input)}
${concatStringsSep "\n" (mapAttrsToList outputStr output)}