amarsyla / hidutil-key-remapping-generator

Simple tool to generate HIDUTIL key remapping configurations for MacOS
https://hidutil-generator.netlify.app/
256 stars 17 forks source link

Add key code for home button #6

Open szhu opened 3 years ago

szhu commented 3 years ago

First, thank you for making this repo!

Can you the home button to the list of keys in the list? The key code is 0x0C00000223 -- I've tested this with hidutil and it works.

Use case:

Many made-for-iOS/Android Bluetooth keyboards have a home button where the escape key should be, which makes them very annoying to use with a computer because there is no escape key! So I'd like to make the button where the escape key should be to actually be an escape key.

I was able to figure out the key code thanks to code in this repo: dnicolson/BluetoothKeyboardEnhancer. I gave a little more context here: https://github.com/dnicolson/BluetoothKeyboardEnhancer/issues/5

eric-hemasystems commented 3 years ago

This worked great for me as well. I used this key code combined with the file this generator creates and now the "home" button works as a proper escape key.

Now my own issue is the Fn key doesn't quite work right. Normally Fn-Up or Fn-Down will page up and down. But instead it opens mission control. I'm guess the Fn key isn't sending the key code for a real fn key?

amarsyla commented 3 years ago

@szhu I am happy to accept PRs for new key codes.

szhu commented 3 years ago

@eric-hemasystems that's weird behavior, and I'm having a hard time seeing how remapping the Home button key can cause that bug. Can you double-check that the bug is in fact cause by your new config?

I think you're right that on these keyboards, the Fn keypress doesn't send anything to the computer. From my observations, the keyboard's behavior seems consistent with this:

I think that last line explains why you're seeing it trigger Mission Control -- the default shortcut for Mission Control Ctrl+Up. Again, I don't think this has to do with what I posted here. Can you confirm that you only see this behavior when you use the key code I posted above? If it is an independent issue, I suggest you open a new issue for it.

eric-hemasystems commented 3 years ago

Sorry, I didn't mean to imply the behavior started when I added this key mapping. Was just saying it's the only thing standing in the way of making this "iOS" keyboard work as a regular keyboard now that your help has fixed the home/escape issue.

I ended up mapping Ctrl-Up and Ctrl-Down to page up and page down so I have the ability to move up and down by the page. It would be nicer if I could use the function key but I think you are right. I think the function key worked entirely internal to the keyboard and it doesn't event notify the OS that the function key was pressed.