Skip to content

Commit

Permalink
Chromeos keycodes (qmk#18212)
Browse files Browse the repository at this point in the history
  • Loading branch information
spidey3 authored and ramonimbao committed Nov 28, 2022
1 parent 47f967e commit a40104b
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 28 deletions.
2 changes: 2 additions & 0 deletions docs/keycodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/>
Expand Down
2 changes: 2 additions & 0 deletions docs/keycodes_basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 1 addition & 12 deletions keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions layouts/community/65_ansi_blocker/spidey3/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion layouts/community/75_ansi/spidey3/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
};
8 changes: 6 additions & 2 deletions quantum/keycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion quantum/keymap_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions quantum/via_ensure_keycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, "");
Expand Down
4 changes: 4 additions & 0 deletions tmk_core/protocol/report.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 0 additions & 7 deletions users/spidey3/spidey3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions users/spidey3/spidey3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a40104b

Please sign in to comment.