Chromeos keycodes (#18212)

This commit is contained in:
Joshua Diamond 2022-09-17 01:48:09 -04:00 committed by GitHub
parent 33c47fe010
commit a26f1ddafa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 22 additions and 28 deletions

View file

@ -207,6 +207,8 @@ See also: [Basic Keycodes](keycodes_basic.md)
|`KC_MEDIA_REWIND` |`KC_MRWD` |Previous Track |✔<sup>6</sup>|✔<sup>5</sup>|✔ |
|`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 |✔ | | |
<sup>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.</sup><br/>
<sup>2. Treated as F13-F15.</sup><br/>

View file

@ -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

View file

@ -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;

View file

@ -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(

View file

@ -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
)
};

View file

@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 <http://www.gnu.org/licenses/>.
#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 {

View file

@ -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

View file

@ -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, "");

View file

@ -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:

View file

@ -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;

View file

@ -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,