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=...
This commit is contained in:
Peter Jones 2022-07-15 13:31:50 -07:00
parent f51ba145fc
commit 2146ecadc4
No known key found for this signature in database
GPG Key ID: 9DAFAA8D01941E49
2 changed files with 15 additions and 15 deletions

View File

@ -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);
};
};
##############################################################################

View File

@ -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 {