From 527737aedb8e88d03531db357f436469fa709974 Mon Sep 17 00:00:00 2001 From: Hans Kruse Date: Tue, 18 Jun 2024 18:49:24 +0200 Subject: [PATCH] feat extra combined modifiers: Include left and Right HYPER, MEH and othe combinations of modifier shortcuts with documentation --- app/include/dt-bindings/zmk/extra_modifiers.h | 54 +++ docs/docs/codes/extra_modifiers.mdx | 48 +++ docs/sidebars.js | 1 + docs/src/data/groups.js | 18 + docs/src/data/hid.js | 336 ++++++++++++++++++ 5 files changed, 457 insertions(+) create mode 100644 app/include/dt-bindings/zmk/extra_modifiers.h create mode 100644 docs/docs/codes/extra_modifiers.mdx diff --git a/app/include/dt-bindings/zmk/extra_modifiers.h b/app/include/dt-bindings/zmk/extra_modifiers.h new file mode 100644 index 00000000..9d314af0 --- /dev/null +++ b/app/include/dt-bindings/zmk/extra_modifiers.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ +#pragma once + +#define LHYP LS(LC(LA(LGUI))) +#define LHYPK(key) LS(LC(LA(LG(key)))) + +#define LMEH LS(LC(LALT)) +#define LMEHK(key) LS(LC(LA(key))) + +#define RHYP RS(RC(RA(RGUI))) +#define RHYPK(key) RS(RC(RA(RG(key)))) + +#define RMEH RS(RC(RALT)) +#define RMEHK(key) RS(RC(RA(key))) + +#define LSG LS(LGUI) +#define LSGK(key) LS(LG(key)) + +#define RSG RS(RGUI) +#define RSGK(key) RS(RG(key)) + +#define LSC LS(LCTRL) +#define LSCK(key) LS(LC(key)) + +#define RSC RS(RCTRL) +#define RSCK(key) RS(RC(key)) + +#define LSA LS(LALT) +#define LSAK(key) LS(LA(key)) + +#define RSA RS(RALT) +#define RSAK(key) RS(RA(key)) + +#define LCA LC(LALT) +#define LCAK(key) LC(LA(key)) + +#define RCA RC(RALT) +#define RCAK(key) RC(RA(key)) + +#define LCG LC(LGUI) +#define LCGK(key) LC(LG(key)) + +#define RCG RC(RGUI) +#define RCGK(key) RC(RG(key)) + +#define LAG LA(LGUI) +#define LAGK(key) LA(LG(key)) + +#define RAG RA(RGUI) +#define RAGK(key) RA(RG(key)) diff --git a/docs/docs/codes/extra_modifiers.mdx b/docs/docs/codes/extra_modifiers.mdx new file mode 100644 index 00000000..6754b249 --- /dev/null +++ b/docs/docs/codes/extra_modifiers.mdx @@ -0,0 +1,48 @@ +--- +title: Extra Modifiers +sidebar_label: Extra Modifiers +hide_title: true +--- + +import OsLegend from "@site/src/components/codes/OsLegend"; +import ToastyContainer from "@site/src/components/codes/ToastyContainer"; +import Table from "@site/src/components/codes/Table"; + + + + +## Extra Modifiers + +Extra modifiers are combinations of the special keyboard keys: _shift_, _alt_, _control_ & _GUI_. + +Extra Modifiers can be used in two forms within ZMK: + +- Modifier [Keys](#modifier-keys) → `HYPL` +- Modifier [Functions](#modifier-functions) → `HYPLK(code)` + +The combination of all modifiers `SHIFT`, `GUI`, `ALT` and `CONTROL` is traditionally refered to as `HYPER`. A dedicated _hyper_ key can be found on the Space Cadet Keyboard. +On Windows some combinations with `HYPER` are bound to start Office (web) applications. On other operating systems all combinations of hyper can be used for other purposes. +The combination of the modifiers, SHIFT, `ALT` and `CONTROL` is referred to as `MEH`. Combinations without `GUI`. + +Other combinations are sometimes used for special keys, e.g. `LSG(F23)`, for pressing left _shift_ _gui_ and _F23_ is used for the 'Copilot' key on Windows systems. + + + +### Extra Modifier Keys + +These act like any other key code. + +- e.g. `&kp HYPL` pushes and releases the combination of the left modifiers SHIFT, GUI, ALT and CONTROL key. + +### 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 LSG(A)` = `LEFT_SHIFT`+`LEFT GUI` +`A` (a capitalized **A**). +- There are left- and right-handed versions of each exta modifier (also see table above): + - `LSGK(x)`, `LSCK(x)`, `LSAK(x)`, `HYPK(x)`, `RSGK(x)`, `RSCK(x)`, `RSAK(x)`, `RHYPK(x)` +- Modified keys can safely be rolled-over. Modifier functions are released when another key is pressed. + - Press `&kp LHYPK(A)`, then press `&kp B`, release `&kp LHYPK(A)` and release `&kp B` results in **?b**. Whatever hyper A does followed by a b. diff --git a/docs/sidebars.js b/docs/sidebars.js index e8c715c8..768875ee 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -64,6 +64,7 @@ module.exports = { "codes/index", "codes/keyboard-keypad", "codes/modifiers", + "codes/extra_modifiers", "codes/editing", "codes/media", "codes/applications", diff --git a/docs/src/data/groups.js b/docs/src/data/groups.js index 5a8dc3cf..74cb8760 100644 --- a/docs/src/data/groups.js +++ b/docs/src/data/groups.js @@ -276,6 +276,24 @@ export default { "LEFT_GUI", "RIGHT_GUI", ], + "keyboard-extra-modifiers": [ + "LHYP", + "RHYP", + "LMEH", + "RMEH", + "LSG", + "RSG", + "LSC", + "RSC", + "LSA", + "RSA", + "LCA", + "RCA", + "LCG", + "RCG", + "LAG", + "RAG", + ], "keyboard-navigation": [ "HOME", "END", diff --git a/docs/src/data/hid.js b/docs/src/data/hid.js index 92b5021f..2a5c40b5 100644 --- a/docs/src/data/hid.js +++ b/docs/src/data/hid.js @@ -4251,6 +4251,342 @@ export default [ }, footnotes: {}, }, + { + names: ["LHYP", "LHYPK(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: ["RHYP", "RHYPK(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: ["LMEH", "LMEHK(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: ["RMEH", "RMEHK(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: ["LSG", "LSGK(code)"], + description: "Left SHIFT, GUI", + 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: ["RSG", "RSGK(code)"], + description: "Right SHIFT, GUI", + 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: ["LSC", "LSCK(code)"], + description: "Left SHIFT, 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: ["RSC", "RSCK(code)"], + description: "Right SHIFT, 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: ["LSA", "LSAK(code)"], + description: "Left SHIFT, ALT", + 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: ["RSA", "RSAK(code)"], + description: "Right SHIFT, ALT", + 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: ["LCA", "LCAK(code)"], + description: "Left CONTROL, ALT", + 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: ["RCA", "RCAK(code)"], + description: "Right CONTROL, ALT", + 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: ["LCG", "LCGK(code)"], + description: "Left CONTROL, GUI", + 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: ["RCG", "RCGK(code)"], + description: "Right CONTROL, GUI", + 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: ["LAG", "LAGK(code)"], + description: "Left ALT, GUI", + 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: ["RAG", "RAGK(code)"], + description: "Right ALT, GUI", + 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",