Ubuntu: Remap a key combination to another combination, e. g. Super+Ctrl+Shift+J -> Ctrl+Shift+Left


I want to implement an addition key layer, so that I can access non-alphanumeric keys without having to move my wrists.

I've been using Autokey for this purpose, but the experience was unsatisfactory: it had occasional lags and let original keystrokes slip into certain apps.

So I need a low-level solution.


Give a combination of xbindkeys and xvkbd a try. xbindkeys listens for the keys and sends the translation to xvkbd.

sudo apt-get install xbindkeys xvkbd  xbindkeys --defaults > /home/your-user-name/.xbindkeysrc  

Open .xbindkeysrc in your favourite editor. I commented everything else out, but it's good to refer to if required.

To check it out, I tried mapping Ctrl+; to Ctrl+V

"xvkbd -xsendevent -text "\Cv""     control + semicolon  

I expect you're after something like this

"xvkbd -xsendevent -text "\C\S\[Left]""    Super+Control+Shift+J  

Save the file, then run xbindkeys

In order to reload any configuration changes, I killed the xbindkeys process then restarted.

xbindkeys syntax

I worked out the key combination by using a GUI for xbindkeys

sudo apt-get install xbindkeys-config  xbindkeys-config  

Once you run that, press Get Key for the combination to put into the second line of your .xbindkeysrc file.

xvkbd syntax

From the manual:

\r - Return  \t - Tab  \b - Backspace  \e - Escape  \d - Delete  \S - Shift (modify the next character; please note that modify with ``\S'' will be ignored in many cases. For example, ``a\Cb\ScD\CE'' will be interpreted as a, Control-b, c, Shift-D, and Control-Shift-E.)  \C - Control (modify the next character)  \A - Alt (modify the next character)  \M - Meta (modify the next character)  \[keysym] - the keysym keysym (e.g., \[Left]), which will be processed in the similar matter with other general characters  \{keysym} - the keysym keysym (e.g., \{Left}), which will be processed in more primitive matter and can also be used for modofier keys such as Control_L, Meta_L, etc.; also, \{+keysym} and \{+keysym} will simulate press and release of the key, respectively [Version 3.3]  \Ddigit - delay digit * 100 ms  \xvalue - move mouse pointer (use "+" or "-" for relative motion)  \yvalue - move mouse pointer (use "+" or "-" for relative motion)  \mdigit - simulate click of the specified mouse button  

Love to hear how it works out and if the combination was fit for your purpose. It looks good as a keymapper, but not necessarily a macro runner.


I think you can find the solution here (because Xorg is the low-level-est layer...): https://wiki.archlinux.org/index.php/Keyboard_configuration_in_Xorg

EDIT: for what I've understood you need to add the option lv3:win_switch in your .conf file

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »