Substitution of keyboard events in Linux?

After several fruitless attempts, still write in the Q&A.


Want to simplify your work with keyboard under Linux (in Windows this is solved with AutoHotKey):

— CapsLock + HJKL arrow (plus a couple of combinations);

naked CapsLock — toggle pickup;

— Shift +CapsLock — real caps.

First attempt: the layout for xkb (caps hung Level3Switch). Naked caps impossible. Moreover, nothing doesn't work in Java applications and some other programs (Monodevelop). In General, a failure.

Second attempt: the demon, robbing the caps and slushy XTestFakeKeyEvent, hold down the keyboard while sending events. Already better, but now is buggy in the Fox (by pressing CapsLock'and prior to its release, lost focus, the cursor can be seen from case to case, the selection is not visible at all). Besides, failed to get to work autorepeat (and for the shooter it is almost necessary).


Came to the conclusion that we need a daemon (perhaps even a kernel module, don't know) will take /dev/input/event0 and give the system something else. How to shraniti the device and read the events, like I found here. Left to figure out how to programmatically create a device that will pickup the system as a keyboard?

I would be grateful for any links/advice on how to implement this venture.

Never wrote a system of things, and to dig up on the Internet couldn't, sorry :)
October 8th 19 at 01:49
3 answers
October 8th 19 at 01:51
Maybe you will help xdotool + xbindkeys?
Looked xbindkeys. Thank you, I have invented a bike! That is, my demon is almost the same yields as those things, but it is not universal and ugly :)
However, there is the same problem — not working autorepeat. Hold down CapsLock+h I will move no more than one position. That, in principle, is clear: at the time of the event, xbindkeys is obliged to release the keyboard (actually, I'm in my bike also did), and all autorepeat off.
That is, the question topic is still relevant, unfortunately. - Maegan_Swift commented on October 8th 19 at 01:54
October 8th 19 at 01:53
As far as I know — all this can be resolved by editing x's config.
The first attempt was just to edit "config x". Quite standard well written layout for standard layouts with a standard L3Switch'eat. It did not help. At least, working full-time means of the x's, definitely not going to be able to get them to perceive the same button as a modifier and as the button (ie naked caps will not fly). - Maegan_Swift commented on October 8th 19 at 01:56
October 8th 19 at 01:55
naked CapsLock — toggle pickup;
— Shift +CapsLock — real caps.

setxkbmap -layout "us,ru(winkeys)" -option "grp:caps_toggle,grp_led:caps"
Um... If this was all that was needed — this question here :)
The first item in the list so just do not do (CapsLock+h == Left, etc.) - Maegan_Swift commented on October 8th 19 at 01:58
I have the opposite question: I use CapsLock to change the layout, and to destination this button never use. How to disable Shift+CapsLock? - Maegan_Swift commented on October 8th 19 at 02:01
He came up, he said. In order to disable Shift+CapsLock enough:
xmodmap -e 'keycode 66 = ISO_Next_Group ISO_Next_Group ISO_Next_Group ISO_Next_Group' 
- Maegan_Swift commented on October 8th 19 at 02:04

Find more questions by tags KeyboardLinuxX.Org