From 2146ecadc440f1949fd0780c3fa7123693909a69 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 15 Jul 2022 13:31:50 -0700 Subject: [PATCH] Correctly set shortcuts that have group names with dots (periods) Some of the shortcut group names (i.e., krunner) have dots in their names. This change ensures that those settings are honored. Before this change the setting for krunner would have been: [org][kde][krunner][desktop] _launch=... And has been fixed so it's now: [org.kde.krunner.desktop] _launch=... --- modules/files.nix | 5 +---- modules/shortcuts.nix | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/files.nix b/modules/files.nix index 651e34b..1070117 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -16,13 +16,10 @@ let options = { configGroupNesting = lib.mkOption { type = lib.types.nonEmptyListOf lib.types.str; + default = (lib.splitString "." name); description = "Group name, and sub-group names."; }; }; - - config = { - configGroupNesting = lib.mkDefault (lib.splitString "." name); - }; }; ############################################################################## diff --git a/modules/shortcuts.nix b/modules/shortcuts.nix index b50d2ca..1d89624 100644 --- a/modules/shortcuts.nix +++ b/modules/shortcuts.nix @@ -5,7 +5,7 @@ let cfg = config.programs.plasma; # Convert one shortcut into a settings attribute set. - shortcutToNameValuePair = action: skey: + shortcutToNameValuePair = _action: skey: let # Keys are expected to be a list: keys = @@ -16,18 +16,21 @@ let # Don't allow un-escaped commas: escape = lib.escape [ "," ]; in - { - name = action; - value = lib.concatStringsSep "," [ - (lib.concatStringsSep "\t" (map escape keys)) - "" # List of default keys, not needed. - "" # Display string, not needed. - ]; - }; + lib.concatStringsSep "," [ + (lib.concatStringsSep "\t" (map escape keys)) + "" # List of default keys, not needed. + "" # Display string, not needed. + ]; shortcutsToSettings = groups: - lib.mapAttrs (_group: lib.mapAttrs' shortcutToNameValuePair) groups; - + lib.mapAttrs + (group: attrs: + (lib.mapAttrs shortcutToNameValuePair attrs) // { + # Some shortcut groups have a dot in their name so we + # explicitly set the group nesting to only one level deep: + configGroupNesting = [ group ]; + }) + groups; in { options.programs.plasma.shortcuts = lib.mkOption {