lib: unwrap special keys in shift, ctrl, meta and super mods
This commit is contained in:
parent
721b9cbbec
commit
2d4d2f58de
1 changed files with 6 additions and 5 deletions
11
lib/mod.nix
11
lib/mod.nix
|
@ -2,15 +2,16 @@
|
|||
|
||||
let
|
||||
inherit (builtins) listToAttrs;
|
||||
inherit (lib) nameValuePair;
|
||||
inherit (lib) nameValuePair removePrefix removeSuffix;
|
||||
|
||||
wrap = val: "<${val}>";
|
||||
unwrap = val: removePrefix "<" (removeSuffix ">" val);
|
||||
|
||||
char = num: wrap "Char-${num}"; # map a character by its decimal, octal or hexadecimal number
|
||||
shift = key: wrap "S-${key}"; # shift-key *shift* *<S-*
|
||||
ctrl = key: wrap "C-${key}"; # control-key *control* *ctrl* *<C-*
|
||||
meta = key: wrap "M-${key}"; # alt-key or meta-key *META* *ALT* *<M-*
|
||||
super = key: wrap "D-${key}"; # command-key or "super" key *<D-*
|
||||
shift = key: wrap "S-${unwrap key}"; # shift-key *shift* *<S-*
|
||||
ctrl = key: wrap "C-${unwrap key}"; # control-key *control* *ctrl* *<C-*
|
||||
meta = key: wrap "M-${unwrap key}"; # alt-key or meta-key *META* *ALT* *<M-*
|
||||
super = key: wrap "D-${unwrap key}"; # command-key or "super" key *<D-*
|
||||
|
||||
keys = listToAttrs (map (v: nameValuePair v (wrap v)) (
|
||||
[
|
||||
|
|
Loading…
Reference in a new issue