fixed hotkeys

This commit is contained in:
Leyla Becker 2025-06-25 18:35:51 -05:00
parent b3f992f001
commit 4c0c443048

View file

@ -42,9 +42,13 @@
hotkeys = lib.mkOption { hotkeys = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule ({name, ...}: { type = lib.types.attrsOf (lib.types.submodule ({name, ...}: {
options = { options = {
key = lib.mkOption {
type = lib.types.strMatching "[a-zA-Z0-9-]+";
default = builtins.replaceStrings [" " "/" "_"] ["-" "-" "-"] name;
};
name = lib.mkOption { name = lib.mkOption {
type = lib.types.strMatching "[a-zA-Z0-9_-]+"; type = lib.types.str;
default = builtins.replaceStrings [" " "/"] ["_" "-"] name; default = name;
}; };
binding = lib.mkOption { binding = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@ -77,34 +81,25 @@
( (
lib.mkMerge ( lib.mkMerge (
builtins.map (value: let builtins.map (value: let
entry = "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/${value.name}"; entry = "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/${value.key}";
in { in {
"org/gnome/settings-daemon/plugins/media-keys" = { ${entry} = {
custom-keybindings = [ binding = value.binding;
"${entry}/" command = value.command;
]; name = value.name;
}; };
${entry} = value; "org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = [
"/${entry}/"
];
};
}) })
( (
lib.attrsets.mapAttrsToList (_: value: value) config.gnome.hotkeys lib.attrsets.mapAttrsToList (_: value: value) config.gnome.hotkeys
) )
) )
) )
# (
# builtins.listToAttrs (
# lib.lists.imap0 (
# i: value: lib.attrsets.nameValuePair "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${toString i}" value
# )
# (lib.attrsets.mapAttrsToList (_: value: value) config.gnome.hotkeys)
# )
# )
# "org/gnome/settings-daemon/plugins/media-keys" = {
# custom-keybindings = [
# "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
# ];
# };
]; ];
}; };
}; };