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 mappings for Pause, Break, ScrLK, SysRq #20

Open almson opened 8 years ago

almson commented 8 years ago

Recent Lenovo keyboards copy Apple by omitting Pause, Break, ScrLK, and SysRq keys. Since these keys are sometimes necessary for PCs (unlike for Macs), they're emulated using Fn+ combinations. I propose to support these same combinations in the driver without a configurable option, since I don't believe there exists a competing way to map them.

Break (Fn + B)
SysRq (Fn + S)
ScrLK (Fn + K)
Pause (Fn + P)

Reference: https://support.lenovo.com/ua/uk/documents/ht074004

almson commented 8 years ago

Actually, Dell keyboards also sometimes don't have these keys. Dell didn't settle on a standard mapping. Looks like they're all over the place with different models. I would still adopt the Lenovo standard.

Aetf commented 8 years ago

I would say we are making the driver a fully programmable one by adding more mapping options like this :smile:. Then definitely we should get the underlying remapping logic right first.

free5lot commented 7 years ago

Well, I got the idea, but not sure if it is desired by people or not. Let this issue be a long term feature request.

almson commented 3 years ago

The real reason for these keys is to use Magic SysRq. (Ie, we need at least SysRq.) Magic SysRq fixes OOM freezes and has other uses.

fvsnippets commented 1 year ago

Hi! For the Magic SysRq issue, I am using a workaround that mixes udev, xmodmap (I know that this won't work on Wayland but there are alternatives for that... but I don't use wayland, yet) and loadkeys.

Basically what I do is: 1) I remap my CapsLock physical key to sysrq keycode using udev. As far as I understand the kernel will know about this "mapping", so It can known when both "SysRq" (CapsLock) and "Alt" key are pressed in conjunction. It wil "take" the event and wont propagate it to the rest of the system (i.e. you can't use Alt+SysRq [CapsLock] for other actions). 2) I (re)remap sysrq xmodmap keycode to Caps_Lock keysym. This is a mapping only know by the X environment. 3) I (re)remap sysrq loadkeys keycode to Caps_Lock keysym. This is a mapping only know by the "consoles" (TTYs) environment.

So, CapsLock will continue acting as a normal CapsLock key without Alt being pressed. But with Alt pressed, CapsLock will act as SysRq. As far as you don't need to use the Alt-CapsLock combination for other things, then this workaround should be enough.