-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remapping keys in X11 #52
Comments
Yesterday, I stumbled upon this site "key naming" and I probably have found a solution. Let's clarify some points. Secondly, the keymapping I have showed earlier is just a one way to do it.
|
To achieve what I wanted, I needed to configure X11. Therefore I used [Xorg Keymapping]. Here are the steps that I have followed:
For example: ~/.xinitrc
xmodmap ~/.xmodmaprc ~/.xmodmaprc
keycode 103 = F13
keycode 120 = F14
... ~/.local/share/sidewinderd/profile_1/s1.xml
<Macro>
<KeyBoardEvent Down="true">95</KeyBoardEvent>
<KeyBoardEvent Down="false">95</KeyBoardEvent>
</Macro> ~/.local/share/sidewinderd/profile_1/s2.xml
<Macro>
<KeyBoardEvent Down="true">112</KeyBoardEvent>
<KeyBoardEvent Down="false">112</KeyBoardEvent>
</Macro> In conclusion, you can now assign shortcuts through F13-F18, which was my initial goal for my additional Text Editor shortcuts. |
Well, with much frustration and work done after achieving nothing, the fucking solution was so simple:
And X11 does support Additional Note: Discovered that in Neovim spontaneously (ditched VSCode for this reason). |
Edit after a YEAR: Solution was just
SHIFT + F1-F12
. See this comment for details.Keyboard management in
X11
is a mess. There are two reasons for this:X server
uses a two layered event handling, which consists ofkeysym
andX-key code
.keysym
is the actual representation of a given letter. On the other hand,X-key code
, as you might guess, is a predefined list of key codes which varies on a givenX server
implementation and on a physical keyboard. Thus, there isn't any standard for which key ties to which unlike as in Linux Kernel, or at least I couldn't found one. (For more information, please visit: VMware)X server
currently supports onlyone-byte
values, which means255
different key codes.The problem I had with that I can't assign my
G
keys throughF13-F18
as mentioned in #35, assee below.F13-F18
keys aren't supported inX-key code
even though they had defined in keysymdef.hAnother problem that may arise is with the key codes bigger than
one-byte
, which are generally media controls. They are completely ignored when pressed.Both of the problems can be solved by binding them to the keys in the
0-255
range.To view your
X-key codes
, use:xmodmap -pke
To view the key code of which key you press, use:
xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'
(from archwiki)For the keys, I used
XF86Launch1 - XF86Launch6
, instead ofF13-F18
and then configured my programs according to these keys.G
keys: In myX server
configuration, my key codes forXF86Launch1 - XF86Launch6
are respectively:156, 157, 210, 211, 192, 193
. I don't know why but to be able to define them as mentioned in Logitech G103 #35 , I had to decrease them by eight. So for example, mys1.xml
key macro has the contents of:one-byte
: You can follow this guide on archwiki.Hope this helps @tolga9009, especially when writing a GUI in the future.
Cheers.
The text was updated successfully, but these errors were encountered: