Closed The-Plottwist closed 1 year ago
Yesterday, I stumbled upon this site "key naming" and I probably have found a solution.
Let's clarify some points.
First of all, Xorg does support "F13 - F18 F24" and key definitions can be found in keysymdef.h and multimedia key definitions in XF86keysym.h.
Secondly, the keymapping I have showed earlier is just a one way to do it. So, here are the other two:
To achieve what I wanted, I needed to configure X11. Therefore I used [Xorg Keymapping].
Here are the steps that I have followed:
xmodmap -pke | grep -i "=\$"
~/.xmodmaprc
file and type keycode EMPTY_KEYCODE_HERE = YOUR_KEY_HERE
(key values are case sensitive and no need for XK_
prefix)xmodmap ~/.xmodmaprc
to asssign them right away.echo 'xmodmap ~/.xmodmaprc' >> ~/.xinitrc
~/.local/share/sidewinderd/profile_1/
). But beware, you have to decrease your key codes by eight.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. Future Edit: Freaking text editor does not recognize X11's "F13-F18". Amazing...
Well, with much frustration and work done after achieving nothing, the fucking solution was so simple:
SHIFT + F1...F12
When combined with
Shift
,Ctrl
andAlt
andWindows
it gave me 60 keys / combinations guaranteed not to clash with anything else on your keyboard or interfere with 99% of software.
And X11 does support F13-F24
. xev
& vscode
were misleading.
In my mind I thought F13
as a seperate key and results were SHIFT + F1
etc. even though what had produced was F13
.
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.Assigning
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 #35 , I had to decrease them by eight. So for example, mys1.xml
key macro has the contents of:Assigning keys that are bigger than
one-byte
: You can follow this guide on archwiki.Hope this helps @tolga9009, especially when writing a GUI in the future.
Cheers.