Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions modules/shortcuts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,22 @@
mkGlobalShortcutFor =
group: _action: skey:
let
# Keys are expected to be a list:
keys =
if !builtins.isList skey then
[ skey ]
else if skey == [ ] then
[ "none" ]
else
skey;

# Don't allow un-escaped commas:
escape = lib.escape [ "," ];
keysStr = builtins.concatStringsSep "\t" (map escape keys);
mkKeysString = lib.concatStringsSep "\t";
in

# If the shortcut is not in the "services" group, we have to sanitize it.
# If the shortcut is not in the "services" group, we have to sanitise it.
if lib.hasPrefix "services/" group then
keysStr
mkKeysString keys
else
lib.concatStringsSep "," [
keysStr
(mkKeysString (map (lib.escape [ "," ]) keys))
"" # List of default keys, not needed.
"" # Display string, not needed.
];
Expand Down
Loading