From a26f1ddafa05c04cc9446109db250c59f689b35a Mon Sep 17 00:00:00 2001 From: Joshua Diamond Date: Sat, 17 Sep 2022 01:48:09 -0400 Subject: [PATCH] Chromeos keycodes (#18212) --- docs/keycodes.md | 2 ++ docs/keycodes_basic.md | 2 ++ .../dmqdesign/spin/keymaps/spidey3_pad/keymap.c | 13 +------------ layouts/community/65_ansi_blocker/spidey3/keymap.c | 4 ++-- layouts/community/75_ansi/spidey3/keymap.c | 2 +- quantum/keycode.h | 8 ++++++-- quantum/keymap_common.c | 2 +- quantum/via_ensure_keycode.h | 2 ++ tmk_core/protocol/report.h | 4 ++++ users/spidey3/spidey3.c | 7 ------- users/spidey3/spidey3.h | 4 +--- 11 files changed, 22 insertions(+), 28 deletions(-) diff --git a/docs/keycodes.md b/docs/keycodes.md index d0ba8e25bf..9121385f1a 100644 --- a/docs/keycodes.md +++ b/docs/keycodes.md @@ -207,6 +207,8 @@ See also: [Basic Keycodes](keycodes_basic.md) |`KC_MEDIA_REWIND` |`KC_MRWD` |Previous Track |✔6|✔5|✔ | |`KC_BRIGHTNESS_UP` |`KC_BRIU` |Brightness Up |✔ |✔ |✔ | |`KC_BRIGHTNESS_DOWN` |`KC_BRID` |Brightness Down |✔ |✔ |✔ | +|`KC_CONTROL_PANEL` |`KC_CPNL` |Open Control Panel |✔ | | | +|`KC_ASSISTANT` |`KC_ASST` |Launch Context-Aware Assistant |✔ | | | 1. The Linux kernel HID driver recognizes [nearly all keycodes](https://github.com/torvalds/linux/blob/master/drivers/hid/hid-input.c), but the default bindings depend on the DE/WM.
2. Treated as F13-F15.
diff --git a/docs/keycodes_basic.md b/docs/keycodes_basic.md index 6f6ef7a3fd..d2a49100d1 100644 --- a/docs/keycodes_basic.md +++ b/docs/keycodes_basic.md @@ -221,6 +221,8 @@ These keycodes are not part of the Keyboard/Keypad usage page. The `SYSTEM_` key |`KC_MEDIA_REWIND` |`KC_MRWD`|Previous Track | |`KC_BRIGHTNESS_UP` |`KC_BRIU`|Brightness Up | |`KC_BRIGHTNESS_DOWN` |`KC_BRID`|Brightness Down | +|`KC_CONTROL_PANEL` |`KC_CPNL`|Open Control Panel | +|`KC_ASSISTANT` |`KC_ASST`|Launch Assistant | ## Number Pad diff --git a/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c b/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c index 77534b9a75..4722e41d07 100644 --- a/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c +++ b/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c @@ -29,8 +29,6 @@ enum layer_base { enum custom_keycodes { HELLO = SAFE_RANGE, - CH_CPNL, // AL Control Panel - CH_ASST, // AL Context-aware Desktop Assistant CH_SUSP, // Suspend }; @@ -40,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { A(S(KC_N)), HELLO, CH_SUSP, TO(_MACRO), KC_MPRV, KC_MPLY, KC_MNXT, TO(_NUMPAD), C(A(KC_COMM)), KC_F5, C(A(KC_DOT)), TO(_RGB), - MO(_FN), CH_ASST, CH_CPNL), + MO(_FN), KC_ASST, KC_CPNL), [_NUMPAD] = LAYOUT( KC_KP_7, KC_KP_8, KC_KP_9, KC_TRNS, @@ -199,19 +197,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; // clang-format off - case CH_CPNL: host_consumer_send(AL_CONTROL_PANEL); return false; - case CH_ASST: host_consumer_send(AL_ASSISTANT); return false; case CH_SUSP: tap_code16(LGUI(LSFT(KC_L))); return true; case HELLO: SEND_STRING("Hello, world!"); return true; // clang-format on } - } else { - switch (keycode) { - case CH_CPNL: - case CH_ASST: - host_consumer_send(0); - return false; - } } return true; diff --git a/layouts/community/65_ansi_blocker/spidey3/keymap.c b/layouts/community/65_ansi_blocker/spidey3/keymap.c index e682a281aa..09e612ae6c 100644 --- a/layouts/community/65_ansi_blocker/spidey3/keymap.c +++ b/layouts/community/65_ansi_blocker/spidey3/keymap.c @@ -26,9 +26,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_FN] = LAYOUT_65_ansi_blocker( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_SLCK, XXXXXXX, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, SPI_GLO, VLK_TOG, CH_SUSP, KC_SLEP, KC_PWR, KC_BRIU, - MO(_GLYPH), RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_G, RGB_M_TW, UC_M_LN, XXXXXXX, XXXXXXX, CH_CPNL, KC_BRID, + MO(_GLYPH), RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_G, RGB_M_TW, UC_M_LN, XXXXXXX, XXXXXXX, KC_CPNL, KC_BRID, _______, XXXXXXX, UC_M_EM, UC_M_WC, UC_MOD, NK_TOGG, TG(_NUMPAD),UC_M_MA, XXXXXXX, XXXXXXX, DEBUG, _______, KC_VOLU, KC_MUTE, - _______, _______, _______, KC_MPLY, CH_ASST, _______, KC_MPRV, KC_VOLD, KC_MNXT + _______, _______, _______, KC_MPLY, KC_ASST, _______, KC_MPRV, KC_VOLD, KC_MNXT ), // Glyph Transformation [_GLYPH] = LAYOUT_65_ansi_blocker( diff --git a/layouts/community/75_ansi/spidey3/keymap.c b/layouts/community/75_ansi/spidey3/keymap.c index 5ede802676..abd941ff32 100644 --- a/layouts/community/75_ansi/spidey3/keymap.c +++ b/layouts/community/75_ansi/spidey3/keymap.c @@ -28,6 +28,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { XXXXXXX, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, SPI_GLO, VLK_TOG, XXXXXXX, XXXXXXX, XXXXXXX, KC_BRIU, XXXXXXX, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_G, RGB_M_TW, UC_M_LN, XXXXXXX, XXXXXXX, XXXXXXX, KC_BRID, _______, XXXXXXX, UC_M_EM, UC_M_WC, UC_MOD, NK_TOGG, TG(_NUMPAD),UC_M_MA, X(LARR), X(RARR), DEBUG, _______, KC_VOLU, KC_MUTE, - _______, _______, _______, KC_MPLY, CH_ASST, _______, CH_CPNL, KC_MPRV, KC_VOLD, KC_MNXT + _______, _______, _______, KC_MPLY, KC_ASST, _______, KC_CPNL, KC_MPRV, KC_VOLD, KC_MNXT ) }; diff --git a/quantum/keycode.h b/quantum/keycode.h index 3c80a386d1..c2103ebaa7 100644 --- a/quantum/keycode.h +++ b/quantum/keycode.h @@ -33,7 +33,7 @@ along with this program. If not, see . #define IS_SPECIAL(code) ((0xA5 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF)) #define IS_SYSTEM(code) (KC_PWR <= (code) && (code) <= KC_WAKE) -#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_BRID) +#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_ASST) #define IS_MOUSEKEY(code) (KC_MS_UP <= (code) && (code) <= KC_MS_ACCEL2) #define IS_MOUSEKEY_MOVE(code) (KC_MS_UP <= (code) && (code) <= KC_MS_RIGHT) @@ -205,6 +205,8 @@ along with this program. If not, see . #define KC_MRWD KC_MEDIA_REWIND #define KC_BRIU KC_BRIGHTNESS_UP #define KC_BRID KC_BRIGHTNESS_DOWN +#define KC_CPNL KC_CONTROL_PANEL +#define KC_ASST KC_ASSISTANT /* System Specific */ #define KC_BRMU KC_PAUSE @@ -502,7 +504,9 @@ enum internal_special_keycodes { KC_MEDIA_FAST_FORWARD, KC_MEDIA_REWIND, KC_BRIGHTNESS_UP, - KC_BRIGHTNESS_DOWN + KC_BRIGHTNESS_DOWN, + KC_CONTROL_PANEL, + KC_ASSISTANT // 0xC0 }; enum mouse_keys { diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 8d7a8bda9a..1d5ef9b403 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -61,7 +61,7 @@ action_t action_for_keycode(uint16_t keycode) { case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE: action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode)); break; - case KC_AUDIO_MUTE ... KC_BRIGHTNESS_DOWN: + case KC_AUDIO_MUTE ... KC_ASSISTANT: action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode)); break; #endif diff --git a/quantum/via_ensure_keycode.h b/quantum/via_ensure_keycode.h index 75f816b560..010e1d92d4 100644 --- a/quantum/via_ensure_keycode.h +++ b/quantum/via_ensure_keycode.h @@ -195,6 +195,8 @@ _Static_assert(KC_MFFD == 0x00BB, ""); _Static_assert(KC_MRWD == 0x00BC, ""); _Static_assert(KC_BRIU == 0x00BD, ""); _Static_assert(KC_BRID == 0x00BE, ""); +_Static_assert(KC_CPNL == 0x00BF, ""); +_Static_assert(KC_ASST == 0x00C0, ""); _Static_assert(KC_LEFT_CTRL == 0x00E0, ""); _Static_assert(KC_LEFT_SHIFT == 0x00E1, ""); diff --git a/tmk_core/protocol/report.h b/tmk_core/protocol/report.h index 735ccdb4a1..b4dbf92a8f 100644 --- a/tmk_core/protocol/report.h +++ b/tmk_core/protocol/report.h @@ -292,6 +292,10 @@ static inline uint16_t KEYCODE2CONSUMER(uint8_t key) { return AL_CALCULATOR; case KC_MY_COMPUTER: return AL_LOCAL_BROWSER; + case KC_CONTROL_PANEL: + return AL_CONTROL_PANEL; + case KC_ASSISTANT: + return AL_ASSISTANT; case KC_WWW_SEARCH: return AC_SEARCH; case KC_WWW_HOME: diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c index d9b893814a..b4c261ce1d 100644 --- a/users/spidey3/spidey3.c +++ b/users/spidey3/spidey3.c @@ -199,8 +199,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // clang-format off - case CH_CPNL: host_consumer_send(AL_CONTROL_PANEL); return false; - case CH_ASST: host_consumer_send(AL_ASSISTANT); return false; case CH_SUSP: tap_code16(LGUI(LSFT(KC_L))); return true; // clang-format on @@ -285,11 +283,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } else { switch (keycode) { - case CH_CPNL: - case CH_ASST: - host_consumer_send(0); - return false; - case SPI_KP_00: unregister_code(KC_KP_0); return false; diff --git a/users/spidey3/spidey3.h b/users/spidey3/spidey3.h index e344b08895..2b2cac0a20 100644 --- a/users/spidey3/spidey3.h +++ b/users/spidey3/spidey3.h @@ -17,9 +17,7 @@ enum userspace_layers { }; enum custom_keycodes { - CH_CPNL = SAFE_RANGE, // AL Control Panel - CH_ASST, // AL Context-aware Desktop Assistant - CH_SUSP, // Suspend + CH_SUSP = SAFE_RANGE, // Suspend SPI_NORMAL, SPI_WIDE,