Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition to the Apple Globe key code to QMK #24661

Open
wants to merge 27 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e1db7e4
Added a default firmware and layout for the WindStudio Wind X R1
ChrisGVE Nov 5, 2024
084a28b
Wind X R1: cleaned-up the folders to make clear that this firmware is
ChrisGVE Nov 5, 2024
43ca630
Merge branch 'qmk:master' into master
ChrisGVE Nov 7, 2024
df21f6d
Merge branch 'qmk:master' into master
ChrisGVE Nov 8, 2024
2859d3d
Delete keyboards/windstudio/wind_x/R1 directory
ChrisGVE Nov 8, 2024
b7422ca
Merge branch 'qmk:master' into master
ChrisGVE Nov 9, 2024
e4541bf
Merge branch 'qmk:master' into main
ChrisGVE Nov 12, 2024
1d5571e
Merge branch 'qmk:master' into main
ChrisGVE Nov 16, 2024
02b20f0
Merge branch 'qmk:master' into main
ChrisGVE Nov 17, 2024
74bef5b
feat(core): add KC_GLOBE keycodes according
ChrisGVE Nov 17, 2024
20cc8b0
fix(core): fix the previous commit for the KC_GLOBE key
ChrisGVE Nov 17, 2024
84d49f6
Merge branch 'qmk:master' into apple
ChrisGVE Nov 23, 2024
bcc0cf9
Merge branch 'qmk:master' into apple
ChrisGVE Nov 29, 2024
c769c2c
Merge branch 'qmk:master' into apple
ChrisGVE Nov 30, 2024
1fd2c0d
feat(globe): added a switch to enable the Globe key
ChrisGVE Nov 30, 2024
061bbb5
docs(globe): added the Globe key to the QMK documentation
ChrisGVE Nov 30, 2024
66c7638
docs(globe key): Updated the .md file to prevent too much churn
ChrisGVE Nov 30, 2024
179fda2
chore(globe key): added keycodes_0.0.7, ran ./util/regen.sh
ChrisGVE Nov 30, 2024
90204f7
fix(keycodes.md): an end tag was missing
ChrisGVE Nov 30, 2024
0027d4b
chore(globe): removing unrelated files
ChrisGVE Nov 30, 2024
ad15e33
Update tmk_core/protocol.mk
ChrisGVE Nov 30, 2024
559cd8c
fix(globe key): corrected the flag set.
ChrisGVE Nov 30, 2024
9fed162
Update data/constants/keycodes/keycodes_0.0.7_basic.hjson
ChrisGVE Nov 30, 2024
39ffd47
Update docs/keycodes.md
ChrisGVE Nov 30, 2024
a80f527
Update docs/keycodes_basic.md
ChrisGVE Nov 30, 2024
fad7f83
Update docs/keycodes.md
ChrisGVE Dec 1, 2024
3ca8651
Update tmk_core/protocol.mk
ChrisGVE Dec 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/constants/keycodes/keycodes_0.0.7.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
12 changes: 12 additions & 0 deletions data/constants/keycodes/keycodes_0.0.7_basic.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"keycodes": {
"0x00C3": {
"group": "media",
"key": "KC_GLOBE",
"label": "Apple Globe/Fn",
"aliases": [
"KC_GLB"
]
}
}
}
2 changes: 2 additions & 0 deletions docs/keycodes.md
ChrisGVE marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ See also: [Basic Keycodes](keycodes_basic)
|`KC_ASSISTANT` |`KC_ASST` |Launch Context-Aware Assistant |✔ | | |
|`KC_MISSION_CONTROL` |`KC_MCTL` |Open Mission Control | |✔ | |
|`KC_LAUNCHPAD` |`KC_LPAD` |Open Launchpad | |✔ | |
|`KC_GLOBE` |`KC_GLB` |Apple Globe/Fn | |✔<sup>7</sup>| |

<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/>
<sup>3. Must be held for about three seconds, and will display a prompt instead.</sup><br/>
<sup>4. Holding Shift+Option allows for finer control of volume level.</sup><br/>
<sup>5. Skips the entire track in iTunes when tapped, seeks within the current track when held.</sup><br/>
<sup>6. WMP does not recognize the Rewind key, but both alter playback speed in VLC.</sup>
<sup>7. The Globe key requires `GLOBE_KEY_ENABLE = yes` to be set in `rules.mk`. When pressed it will reveal the emoji picker, and it can be combined with other keys. Note however that Globe+F-keys or Globe+arrow do not work.</sup>
ChrisGVE marked this conversation as resolved.
Show resolved Hide resolved

## Quantum Keycodes {#quantum-keycodes}

Expand Down
1 change: 1 addition & 0 deletions docs/keycodes_basic.md
ChrisGVE marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ Some of these keycodes may behave differently depending on the OS. For example,
|`KC_ASSISTANT` |`KC_ASST`|Launch Assistant |
|`KC_MISSION_CONTROL` |`KC_MCTL`|Open Mission Control|
|`KC_LAUNCHPAD` |`KC_LPAD`|Open Launchpad |
|`KC_GLOBE` |`KC_GLB` |Apple Globe/Fn |

## Number Pad

Expand Down
6 changes: 4 additions & 2 deletions quantum/keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ enum qk_keycode_defines {
KC_ASSISTANT = 0x00C0,
KC_MISSION_CONTROL = 0x00C1,
KC_LAUNCHPAD = 0x00C2,
KC_GLOBE = 0x00C3,
QK_MOUSE_CURSOR_UP = 0x00CD,
QK_MOUSE_CURSOR_DOWN = 0x00CE,
QK_MOUSE_CURSOR_LEFT = 0x00CF,
Expand Down Expand Up @@ -943,6 +944,7 @@ enum qk_keycode_defines {
KC_ASST = KC_ASSISTANT,
KC_MCTL = KC_MISSION_CONTROL,
KC_LPAD = KC_LAUNCHPAD,
KC_GLB = KC_GLOBE,
MS_UP = QK_MOUSE_CURSOR_UP,
MS_DOWN = QK_MOUSE_CURSOR_DOWN,
MS_LEFT = QK_MOUSE_CURSOR_LEFT,
Expand Down Expand Up @@ -1488,7 +1490,7 @@ enum qk_keycode_defines {
#define IS_INTERNAL_KEYCODE(code) ((code) >= KC_NO && (code) <= KC_TRANSPARENT)
#define IS_BASIC_KEYCODE(code) ((code) >= KC_A && (code) <= KC_EXSEL)
#define IS_SYSTEM_KEYCODE(code) ((code) >= KC_SYSTEM_POWER && (code) <= KC_SYSTEM_WAKE)
#define IS_CONSUMER_KEYCODE(code) ((code) >= KC_AUDIO_MUTE && (code) <= KC_LAUNCHPAD)
#define IS_CONSUMER_KEYCODE(code) ((code) >= KC_AUDIO_MUTE && (code) <= KC_GLOBE)
#define IS_MOUSE_KEYCODE(code) ((code) >= QK_MOUSE_CURSOR_UP && (code) <= QK_MOUSE_ACCELERATION_2)
#define IS_MODIFIER_KEYCODE(code) ((code) >= KC_LEFT_CTRL && (code) <= KC_RIGHT_GUI)
#define IS_SWAP_HANDS_KEYCODE(code) ((code) >= QK_SWAP_HANDS_TOGGLE && (code) <= QK_SWAP_HANDS_ONE_SHOT)
Expand All @@ -1514,7 +1516,7 @@ enum qk_keycode_defines {
#define INTERNAL_KEYCODE_RANGE KC_NO ... KC_TRANSPARENT
#define BASIC_KEYCODE_RANGE KC_A ... KC_EXSEL
#define SYSTEM_KEYCODE_RANGE KC_SYSTEM_POWER ... KC_SYSTEM_WAKE
#define CONSUMER_KEYCODE_RANGE KC_AUDIO_MUTE ... KC_LAUNCHPAD
#define CONSUMER_KEYCODE_RANGE KC_AUDIO_MUTE ... KC_GLOBE
#define MOUSE_KEYCODE_RANGE QK_MOUSE_CURSOR_UP ... QK_MOUSE_ACCELERATION_2
#define MODIFIER_KEYCODE_RANGE KC_LEFT_CTRL ... KC_RIGHT_GUI
#define SWAP_HANDS_KEYCODE_RANGE QK_SWAP_HANDS_TOGGLE ... QK_SWAP_HANDS_ONE_SHOT
Expand Down
1 change: 1 addition & 0 deletions tests/test_common/keycode_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ std::map<uint16_t, std::string> KEYCODE_ID_TABLE = {
{KC_ASSISTANT, "KC_ASSISTANT"},
{KC_MISSION_CONTROL, "KC_MISSION_CONTROL"},
{KC_LAUNCHPAD, "KC_LAUNCHPAD"},
{KC_GLOBE, "KC_GLOBE"},
{QK_MOUSE_CURSOR_UP, "QK_MOUSE_CURSOR_UP"},
{QK_MOUSE_CURSOR_DOWN, "QK_MOUSE_CURSOR_DOWN"},
{QK_MOUSE_CURSOR_LEFT, "QK_MOUSE_CURSOR_LEFT"},
Expand Down
6 changes: 6 additions & 0 deletions tmk_core/protocol.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ SRC += \
$(PROTOCOL_DIR)/usb_device_state.c \
$(PROTOCOL_DIR)/usb_util.c \

ifeq ($(strip $(GLOBE_KEY_ENABLE)), yes)
OPT_DEFS += -DGLOBE_KEY_ENABLE
# The globe key requires KEYBOARD_SHARED_EP
KEYBOARD_SHARED_EP = yes
endif

ChrisGVE marked this conversation as resolved.
Show resolved Hide resolved
SHARED_EP_ENABLE = no
MOUSE_SHARED_EP ?= yes
ifeq ($(strip $(KEYBOARD_SHARED_EP)), yes)
Expand Down
4 changes: 3 additions & 1 deletion tmk_core/protocol/report.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// clang-format off

/* HID report IDs */
enum hid_report_ids {
enum hid_report_ids {
REPORT_ID_ALL = 0,
REPORT_ID_KEYBOARD = 1,
REPORT_ID_MOUSE,
Expand Down Expand Up @@ -327,6 +327,8 @@ static inline uint16_t KEYCODE2CONSUMER(uint8_t key) {
return AC_DESKTOP_SHOW_ALL_WINDOWS;
case KC_LAUNCHPAD:
return AC_SOFT_KEY_LEFT;
case KC_GLOBE:
return AC_NEXT_KEYBOARD_LAYOUT_SELECT;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this KC_GLOBE does exactly that, and only suitable for switching layouts, not really sending Globe codes.

Copy link
Contributor Author

@ChrisGVE ChrisGVE Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking, you are right, but in practice, on a Mac, it operates as a key.

  • pressed alone, it triggers the emoji picker (or what is configured in the Mac settings for the Keyboard)
  • it can be used as a "modifier" with specific keys, for instance
    • Globe+A to toggle the dock when hidden,
    • Globe+C to toggle control center,
    • Globe+F to toggle full screen,
    • Globe+H to show the desktop,
    • Globe+N to toggle Notification Center,
    • Globe+Q launch notes.

Unfortunately, there are other cases where I have yet to have success. In particular, Globe+Arrow keys combinations, but I typically use 60% keyboards, so arrow keys are hard to test with those.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the keycode works on Windows/Linux too (but as layout select), then it would be worth having appropriate aliases too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a pure Windows or Linux machine, but I can investigate using a virtual machine. I'll see whether I have time tomorrow to try that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows does not seem to react to the AC Next Keyboard Layout Select usage, but I can see it coming in through Wireshark.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I tried this morning while at work on Windows 10, and nada, no reaction to the key. I'll try Linux later; I suspect I'll see the same thing.

default:
return 0;
}
Expand Down