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

Not key for mac OS globe/Fn key? #92

Open
LINCH8 opened this issue Feb 20, 2021 · 10 comments
Open

Not key for mac OS globe/Fn key? #92

LINCH8 opened this issue Feb 20, 2021 · 10 comments

Comments

@LINCH8
Copy link

LINCH8 commented Feb 20, 2021

Can someone explain how to use VIA to map key to mac layout? Nothing in the ReadMe file or anywhere I can find documents. Also, the screen brightness key that you usually can control on mac with F1, F2. How to do that on VIA?
(keyboard: NK65)

@Archerious
Copy link

Same question here

@kylecordes
Copy link

So far I'm really surprised that I can't find examples of layout files suitable for use with a Mac with various size keyboards. I assumed I'd search and find a community of people sharing and comparing layout files.

I have an answer for @LINCH8 though. Look under the "special" category. You will see "screen -" and "screen +". You can map those on F1 and F2, or to a layer on the same keys.

@nikosdion
Copy link

Fellow macOS user with a YMD75 v3 keyboard, currently using VIA. I am not a firmware developer but I grasp enough to tell you what's going on and why — at least to the best of my understanding.

VIA runs on QMK firmware. QMK itself doesn't support the special macOS fn key for the reasons stated in https://beta.docs.qmk.fm/faqs/faq_keymap#fn-key-on-macos

While the key can, in theory, be implemented (albeit turning 6KRO to 5KRO) it also requires changing the USB vendor ID to pretend it's a genuine Apple keyboard. This may have legal implications if they included it in QMK so they just don't merge that. I am not sure it's a valid reason since I also have a Keychron K3 and a NuPhy F1 which seem to be doing exactly that: lie about the USB vendor ID. It is what it is...

My solution as a Mac user was to create a new layer which maps F1 to Scroll and F2 to Pause (i.e. F14 and F15) which macOS recognises as screen brightness up/down. I map F7 to F12 to Previous, Play, Next, Mute, Vol - and Vol + and fn+up/down/left/right to PgUp/PgDn/Home/End. This emulates most of the fn keys on an Apple keyboard. Since there is no provision for Launchpad and Mission Control (these only work on Apple keyboards because of the way Apple's Darwin kernel handles USB HID) I map fn+F3/F4 to F13 and F16. Then I went to the Keyboard preferences applet in macOS' System Options, Shortcuts tab and mapped these keys to the respective functions. In other words Launchpad, Show Launchpad is mapped to F13 and Mission Control, Show Mission Control is mapped to F16. Doing that doesn't break your Apple keyboard mappings because its special keys send special scan codes (not supported by QMK) which are recognised by macOS' kernel. I've mapped the second key to the right of my spacebar as MO(2) where 2 is the layer number with my fn+SOMETHING key mappings. I put the fn keycap there so now I get almost the same fn behaviour as an Apple keyboard. However, since the fn key is mapped at the firmware level and sends nothing over the wire I don't get double tap fn to activate dictation and single fn tap to change keyboard languages. Small price to pay for a much better typing experience :)

As to why the Launchpad, Mission Control, Globe etc keys' scancodes are not available in QMK, the reason is that QMK only has an 8-bit space for scan codes and it's mostly full. Technically it's 16-bit but the high bits are used for combined scan codes, Unicode support etc. It pretty much means that us macOS users are outta luck unless we get creative with layers and the configuration of our Macs (or use an app like Karabiner Elements to remap certain keypresses).

Now you understand why nobody makes layout files suitable for Mac for any board. The layout by itself would be half the solution. The other half is about how you configure keyboard shortcuts in macOS.

@LINCH8
Copy link
Author

LINCH8 commented Apr 25, 2021

So my solution was to go to "System preference" --> "keyboard" --> Check the box for "Use F1, F2, etc...."
I have no solution for the globe key, but that does not bother me

@dbrumley
Copy link

I just got bit by this. I spent a few hours trying to figure out how to get the macos app "presentify" to work properly. Couldn't get it to work on any non-mac keyboard because it relies on the "Globe" key.

Just adding a note here in case it helps any future people looking into the same issue.

@blipinsk
Copy link

The partial workaround is to add a macro with:

{KC_LGUI,KC_LCTL,KC_SPC}

It's working slightly worse to the 🌐 button, but still provides the same functionality.

@ygycjdr
Copy link

ygycjdr commented May 12, 2023

add a macro
{KC_LCTL,KC_SPC}
to the Fn key using the VIA key remapping website."

@steelrooter
Copy link

steelrooter commented Aug 7, 2023

Both the above recommended mappings weren't working for me, but this is working well:

{+KC_LCTL}{KC_SPC}{800}{-KC_LCTL}

@hujunhan
Copy link

add a macro {KC_LCTL,KC_SPC} to the Fn key using the VIA key remapping website."

Tested on Mac Sonoma, works for me. I use globe to change input source

@danieltharp
Copy link

danieltharp commented Nov 22, 2023

I fought with this for a bit but VIA wasn't accepting the {+KC_LCTL} or {800} on my Keychron Q6. I wanted it on the Microphone key which was currently going to Spotlight Search. In the Keyboard Shortcuts menu on Sonoma, the setting to toggle this is Input Sources -> Select the previous input source. I just remapped it from there (which went to Cmd+Space), then remapped Spotlight to the now-free Ctrl+Space.

In practice this isn't exactly the same as the Globe button. You have to press it twice for it to register the change (which is the same most of the time), but the language picker doesn't appear long enough to be useful. If you only have two languages this is fine, and the source icon at the top will tell you where you're at.

My understanding is that the Globe key is doing some sort of M0 layer toggle under the hood that we can't replicate easily, which is why all the alternate ways of doing it feel a little different from native.

Edit to add: If you tap it three or more times with sufficient delay the language picker menu will pop up like normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants