From 73091bb0375ffcd8d420abfc85eca196c2ec5580 Mon Sep 17 00:00:00 2001 From: Hans Kruse Date: Sat, 13 Jul 2024 10:02:11 +0200 Subject: [PATCH 1/2] Add modifiers MEH and Hyper as well as a COPILOT key. --- app/include/dt-bindings/zmk/keys.h | 3 + app/include/dt-bindings/zmk/modifiers.h | 19 ++++- docs/docs/codes/modifiers.mdx | 30 +++++++ docs/src/data/groups.js | 6 ++ docs/src/data/hid.js | 105 ++++++++++++++++++++++++ 5 files changed, 162 insertions(+), 1 deletion(-) diff --git a/app/include/dt-bindings/zmk/keys.h b/app/include/dt-bindings/zmk/keys.h index 364ffa86..0d30b0fb 100644 --- a/app/include/dt-bindings/zmk/keys.h +++ b/app/include/dt-bindings/zmk/keys.h @@ -1443,3 +1443,6 @@ /* Apple Globe key */ #define C_AC_NEXT_KEYBOARD_LAYOUT_SELECT (ZMK_HID_USAGE(HID_USAGE_CONSUMER, 0x029D)) #define GLOBE (C_AC_NEXT_KEYBOARD_LAYOUT_SELECT) + +/* Microsoft Copilot key */ +#define COPILOT LS(LG(F23)) diff --git a/app/include/dt-bindings/zmk/modifiers.h b/app/include/dt-bindings/zmk/modifiers.h index b49849d0..01dfca46 100644 --- a/app/include/dt-bindings/zmk/modifiers.h +++ b/app/include/dt-bindings/zmk/modifiers.h @@ -25,4 +25,21 @@ #define RC(keycode) APPLY_MODS(MOD_RCTL, keycode) #define RS(keycode) APPLY_MODS(MOD_RSFT, keycode) #define RA(keycode) APPLY_MODS(MOD_RALT, keycode) -#define RG(keycode) APPLY_MODS(MOD_RGUI, keycode) \ No newline at end of file +#define RG(keycode) APPLY_MODS(MOD_RGUI, keycode) + +#define LEFT_HYPER LS(LC(LA(LGUI))) +#define LH(key) LS(LC(LA(LG(key)))) +#define LHYPER LEFT_HYPER +#define OFFICE LEFT_HYPER + +#define LEFT_MEH LS(LC(LALT)) +#define LM(key) LS(LC(LA(key))) +#define LMEH LEFT_MEH + +#define RIGHT_HYPER RS(RC(RA(RGUI))) +#define RH(key) RS(RC(RA(RG(key)))) +#define RHYPER RIGHT_HYPER + +#define RIGHT_MEH RS(RC(RALT)) +#define RM(key) RS(RC(RA(key))) +#define RMEH RIGHT_MEH diff --git a/docs/docs/codes/modifiers.mdx b/docs/docs/codes/modifiers.mdx index db88ee92..56d17029 100644 --- a/docs/docs/codes/modifiers.mdx +++ b/docs/docs/codes/modifiers.mdx @@ -46,3 +46,33 @@ These functions take the form: `XX(code)` - `LS(x)`, `LC(x)`, `LA(x)`, `LG(x)`, `RS(x)`, `RC(x)`, `RA(x)`, `RG(x)` - Modified keys can safely be rolled-over. Modifier functions are released when another key is pressed. - Press `&kp LS(A)`, then press `&kp B`, release `&kp LS(A)` and release `&kp B` results in **Ab**. Only the A is capitalized. + +### Extra Modifiers + +Extra modifiers are combinations of the special keyboard keys: _shift_, _alt_, _control_ & _GUI_. + +Extra Modifiers can be used in the following forms within ZMK: + +- `LHYPER` +- `LH(code)` + + + +The combination of all modifiers `SHIFT`, `GUI`, `ALT` and `CONTROL` is colloquially known as `HYPER`. +Similarly, the combination of `SHIFT`, `ALT` and `CONTROL` (without `GUI`) is referred to as `MEH`. + +### Extra Modifier Keys + +These act like any other key code. + +- e.g. `&kp LHYPER` pushes and releases the combination of the left modifiers SHIFT, GUI, ALT and CONTROL. + +### Extra Modifier Functions + +Modifier functions add one or more modifiers to a code. + +These functions take the form: `XX(code)` + +- Modifier functions apply a modifier to a code: + - `&kp LH(W)` = `LEFT SHIFT` + `LEFT GUI` + `LEFT CONTROL` + `LEFT ALT` + `W`; in recent versions of Windows, this will open Microsoft Word. +- There are left- and right-handed versions of each extra modifier (also see table above). diff --git a/docs/src/data/groups.js b/docs/src/data/groups.js index 5a8dc3cf..d8b053ab 100644 --- a/docs/src/data/groups.js +++ b/docs/src/data/groups.js @@ -276,6 +276,12 @@ export default { "LEFT_GUI", "RIGHT_GUI", ], + "keyboard-extra-modifiers": [ + "LEFT_MEH", + "RIGHT_MEH", + "LEFT_HYPER", + "RIGHT_HYPER", + ], "keyboard-navigation": [ "HOME", "END", diff --git a/docs/src/data/hid.js b/docs/src/data/hid.js index 92b5021f..2703608b 100644 --- a/docs/src/data/hid.js +++ b/docs/src/data/hid.js @@ -4251,6 +4251,90 @@ export default [ }, footnotes: {}, }, + { + names: ["LEFT_HYPER", "LHYPER", "OFFICE", "LH(code)"], + description: "Left Hyper: Left SHIFT, GUI, ALT, CONTROL", + context: "Keyboard", + clarify: false, + usages: [ + { + application: keyboardApplication, + item: usage(keyPage, 0xe1), + }, + ], + documentation: "", + os: { + windows: true, + linux: true, + android: true, + macos: true, + ios: true, + }, + footnotes: {}, + }, + { + names: ["RIGHT_HYPER", "RHYPER", "RH(code)"], + description: "Right HYPER: Right SHIFT, GUI, ALT, CONTROL", + context: "Keyboard", + clarify: false, + usages: [ + { + application: keyboardApplication, + item: usage(keyPage, 0xe1), + }, + ], + documentation: "", + os: { + windows: true, + linux: true, + android: true, + macos: true, + ios: true, + }, + footnotes: {}, + }, + { + names: ["LEFT_MEH", "LM(code)"], + description: "Left MEH: Left SHIFT, ALT, CONTROL", + context: "Keyboard", + clarify: false, + usages: [ + { + application: keyboardApplication, + item: usage(keyPage, 0xe1), + }, + ], + documentation: "", + os: { + windows: true, + linux: true, + android: true, + macos: true, + ios: true, + }, + footnotes: {}, + }, + { + names: ["RIGHT_MEH", "RM(code)"], + description: "Right MEH: Right SHIFT, ALT, CONTROL", + context: "Keyboard", + clarify: false, + usages: [ + { + application: keyboardApplication, + item: usage(keyPage, 0xe1), + }, + ], + documentation: "", + os: { + windows: true, + linux: true, + android: true, + macos: true, + ios: true, + }, + footnotes: {}, + }, { names: ["K_PLAY_PAUSE", "K_PP"], description: "Play / Pause", @@ -7888,4 +7972,25 @@ export default [ macos: ["globe"], }, }, + { + names: ["COPILOT"], + description: "Microsoft Copilot shortcut LS(LG(F23))", + context: "Keyboard", + clarify: false, + usages: [ + { + application: keyboardApplication, + item: usage(keyPage, 0x72), + }, + ], + documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=86", + os: { + windows: true, + linux: null, + android: null, + macos: null, + ios: null, + }, + footnotes: {}, + }, ]; From 75d7fc6e68f1d1e24dcf15d9b81491a9d4ce372d Mon Sep 17 00:00:00 2001 From: Hans Kruse Date: Sun, 14 Jul 2024 13:15:51 +0200 Subject: [PATCH 2/2] Updated test results --- docs/src/data/hid.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/src/data/hid.js b/docs/src/data/hid.js index 2703608b..6a3836ac 100644 --- a/docs/src/data/hid.js +++ b/docs/src/data/hid.js @@ -4267,8 +4267,8 @@ export default [ windows: true, linux: true, android: true, - macos: true, - ios: true, + macos: null, + ios: null, }, footnotes: {}, }, @@ -4288,8 +4288,8 @@ export default [ windows: true, linux: true, android: true, - macos: true, - ios: true, + macos: null, + ios: null, }, footnotes: {}, }, @@ -4309,8 +4309,8 @@ export default [ windows: true, linux: true, android: true, - macos: true, - ios: true, + macos: null, + ios: null, }, footnotes: {}, }, @@ -4330,8 +4330,8 @@ export default [ windows: true, linux: true, android: true, - macos: true, - ios: true, + macos: null, + ios: null, }, footnotes: {}, },