diff --git a/cfg_samples/jtroo.kbd b/cfg_samples/jtroo.kbd index 1f5b66867..52480e489 100644 --- a/cfg_samples/jtroo.kbd +++ b/cfg_samples/jtroo.kbd @@ -76,10 +76,12 @@ _ _ _ _ _ _ _ ) +(defalias win M-tab) + (deflayer numbers _ _ _ _ _ _ nlk kp7 kp8 kp9 _ _ _ _ _ _ _ _ _ XX _ kp4 kp5 kp6 - _ _ _ - _ _ C-z _ _ XX _ kp1 kp2 kp3 + _ _ + _ _ C-z C-y @win XX _ kp1 kp2 kp3 + _ _ _ C-z C-x C-c C-v XX _ kp0 kp0 . / _ _ _ _ _ _ _ _ ) diff --git a/cfg_samples/kanata.kbd b/cfg_samples/kanata.kbd index a7be3f649..e738925ce 100644 --- a/cfg_samples/kanata.kbd +++ b/cfg_samples/kanata.kbd @@ -108,10 +108,6 @@ ;; tap for capslk, hold for lctl cap (tap-hold 200 200 caps lctl) - - ;; Chords. These ones are used for copying/pasting from some Linux terminals. - csv C-S-v - csc C-S-c ) (defalias @@ -131,12 +127,21 @@ ;; for modifiers like shift. You probably want to use macro instead. ;; ;; Chording can be more succinctly described by the modifier prefixes - ;; `C-`, `A-`, and `S-` for lctrl, lalt, lshift, but are possible by using - ;; multi as well. + ;; `C-`, `A-`, `S-`, and `M-` for lctrl, lalt, lshift, lmeta, but are possible + ;; by using the `multi` as well. The lmeta key is also known by some other + ;; names: "Windows", "GUI", "Command", "Super". ;; ;; One use case for multi could be typing an all-caps string. alp (multi lsft a b c d e f g h i j k l m n o p q r s t u v w x y z) + ;; Chords using the shortuct. These ones are used for copying/pasting + ;; from some Linux terminals. + csv C-S-v + csc C-S-c + + ;; Windows shortcut for displaying all windows + win M-tab + ;; macro accepts keys, chords, and numbers (a delay in ms). Note that numbers ;; will be parsed as delays, so they will need to be aliased to be used. lch (macro h t t p @: / / 100 l o c a l h o s t @: @8 @0 @8 @0) diff --git a/src/cfg.rs b/src/cfg.rs index f8c4acf09..432eee2ae 100644 --- a/src/cfg.rs +++ b/src/cfg.rs @@ -688,6 +688,12 @@ fn parse_action_atom(ac: &str, aliases: &Aliases) -> Result<&'static KanataActio } key_stack.push(KeyCode::LAlt); rem = rest; + } else if let Some(rest) = rem.strip_prefix("M-") { + if key_stack.contains(&KeyCode::LGui) { + bail!("Redundant \"M-\" in {}", ac) + } + key_stack.push(KeyCode::LGui); + rem = rest; } else if let Some(oscode) = str_to_oscode(rem) { key_stack.push(oscode.into()); return Ok(sref(Action::MultipleKeyCodes(sref(key_stack).as_ref())));