free5lot / hid-apple-patched

Allows to swap the Fn key and left Control key and other tweaks on Macbook Pro and Apple keyboards in GNU/Linux
GNU General Public License v2.0
350 stars 61 forks source link

Add fnesc_toggle to be able to toggle the fn key #56

Open acheronfail opened 4 years ago

acheronfail commented 4 years ago

This fixes #35.

This adds a new option: fnesc_toggle which, when set to 1 adds the fn + esc keybinding that automatically switches fnmode between 1 and 2.

I chose fn + esc since all the non-Apple laptops I've owned (mostly Dells) have this keybinding, so as far as I know it's kind of a standard.


Right now, when using this patch users need to press fn + esc to toggle the fnmode.

I've noticed that it doesn't work if you hold down fn and then press esc after a short delay... It only seems to work if you press them rather quickly (maybe something to do with key-repeat?).

free5lot commented 4 years ago

@acheronfail Thanks for this information and PR. I will take a deeper look and review it during holidays.

free5lot commented 4 years ago

I looked through the code on website and it's a quite short and easy to understand PR. So, I preliminary I approve it, but you still have to wait for holidays (first part of Jan) when I will be able to think about possible issues and make a test. Thanks for the PR.

free5lot commented 4 years ago

I'm in process of playing with current mainline kernel (5.5.0-rc5). If everything goes fine, I will try to push the patches upstream once more. Starting with the main one (about fn-ctrl swap) all others if it goes well.

ejuarezg commented 4 years ago

Hi @acheronfail I've tried out your code and I think it's great. However, would it be possible to add a visual indicator when the keys have been toggled? It usually takes a few tries to get the toggle working and a visual indicator would show you when you've correctly toggled the keys. I've tried making the caps lock LED on my macbook pro 2015 flash on a successful toggle but it doesn't work. I'm new to kernel module coding and C in general so I don't fully understand what I'm doing. Any comments on how it could or couldn't work are appreciated.

acheronfail commented 4 years ago

Hey @ejuarezg, sorry I can't be more help, but I don't know much about kernel module coding either. I just forked this repository and changed what was already there - I wouldn't have the faintest idea of how to add visual indicators to this.

ejuarezg commented 4 years ago

No worries. Thanks for your input.