1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 19:49:45 +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.placeholder ${colorSetStr colors.placeholder}
client.background ${colors.background} client.background ${colors.background}
${keybindingsStr keybindings} ${keybindingsStr { inherit keybindings; }}
${keycodebindingsStr keycodebindings} ${keycodebindingsStr keycodebindings}
${concatStringsSep "\n" (mapAttrsToList modeStr modes)} ${concatStringsSep "\n" (mapAttrsToList modeStr modes)}
${concatStringsSep "\n" (mapAttrsToList assignStr assigns)} ${concatStringsSep "\n" (mapAttrsToList assignStr assigns)}

View file

@ -8,10 +8,10 @@ rec {
concatStringsSep " " (mapAttrsToList (k: v: ''${k}="${v}"'') criteria) concatStringsSep " " (mapAttrsToList (k: v: ''${k}="${v}"'') criteria)
}]"; }]";
keybindingsStr = keybindings: keybindingsStr = { keybindings, bindsymArgs ? "" }:
concatStringsSep "\n" (mapAttrsToList (keycomb: action: concatStringsSep "\n" (mapAttrsToList (keycomb: action:
optionalString (action != null) "bindsym ${ optionalString (action != null) "bindsym ${
lib.optionalString (moduleName == "sway") "--to-code " lib.optionalString (bindsymArgs != "") "${bindsymArgs} "
}${keycomb} ${action}") keybindings); }${keycomb} ${action}") keybindings);
keycodebindingsStr = keycodebindings: keycodebindingsStr = keycodebindings:
@ -31,7 +31,7 @@ rec {
modeStr = name: keybindings: '' modeStr = name: keybindings: ''
mode "${name}" { 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 { input = mkOption {
type = types.attrsOf (types.attrsOf types.str); type = types.attrsOf (types.attrsOf types.str);
default = { }; default = { };
@ -259,7 +268,11 @@ let
client.placeholder ${colorSetStr colors.placeholder} client.placeholder ${colorSetStr colors.placeholder}
client.background ${colors.background} client.background ${colors.background}
${keybindingsStr keybindings} ${keybindingsStr {
inherit keybindings;
bindsymArgs =
lib.optionalString (cfg.config.bindkeysToCode) "--to-code";
}}
${keycodebindingsStr keycodebindings} ${keycodebindingsStr keycodebindings}
${concatStringsSep "\n" (mapAttrsToList inputStr input)} ${concatStringsSep "\n" (mapAttrsToList inputStr input)}
${concatStringsSep "\n" (mapAttrsToList outputStr output)} ${concatStringsSep "\n" (mapAttrsToList outputStr output)}