見出し画像

#QMK : GUI key codeって何?

QMK firmwareにおけるkey codeのGUIとはmacOSで言うところのCommand key、WindowsOSでいうところのWindows keyである。

  • Left GUI (Windows/Command/Meta key): KC_LEFT_GUI

    • KC_LGUI, KC_LCMD, KC_LWIN

  • Right GUI (Windows/Command/Meta key): KC_RIGHT_GUI

    • KC_RGUI, KC_RCMD, KC_RWIN

んだけどなんでGUIっていうのかは、GUI(Graphical User Interface)を操作に関連するkeyって意味らしいんだけど、誰が言い始めたのよってのは疑問だったが、同じことを疑問に思ってる人がいた。

USB HIDのSpecらしい。

Device Class Definition for Human Interface Devices (HID) Version 1.11ってのがusb.orgから探すことができて、この辺をベースにQMKはMODの定義やreport codeを決めているようだ。

# 8.3 Report Format for Array Items

Each button in an array reports an assigned number called an array index. This can be translated into a keycode by looking up the array elements Usage Page and Usage. When any button transitions between open and closed, the entire list of indices for buttons currently closed in the array is transmitted to the host.
Since only one array element can be reported in each array field, modifier keys should be reported as bitmap data (a group of 1-bit variable fields). For example, keys such as CTRL, SHIFT, ALT, and GUI keys make up the 8 bit modifier byte in a standard keyboard report. Although these usage codes are defined in the Usage Table as E0–E7, the usage is not sent as array data. The modifier byte is defined
as follows.

Bit   Key
-----------------------------------------------------
0    LEFT CTRL
1     LEFT SHIFT
2     LEFT ALT
3     LEFT GUI
4     RIGHT CTRL
5     RIGHT SHIFT
6    RIGHT ALT
7    RIGHT GUI

Device Class Definition for Human Interface Devices (HID) Version 1.11
https://www.usb.org/sites/default/files/hid1_11.pdf

特定のOSに依存しない形で表現したのがGUIなのかしら。

mods_8bit

report_keyboard_t


いいなと思ったら応援しよう!

PersonalStudio
Tipってなんかイイね、Beer me : )