Not working at all on Kernel 6.9.7
I was able to use keyd on a different device about two years ago or so, but trying to set up keyd on another device with Kernel 6.9.7 (Debian Testing) results in no result. Compiling works, the systemd service does start too. These are the logs of keyd, which look as expected:
Jul 03 12:51:33 pc01 systemd[1]: Started keyd.service - key remapping daemon.
Jul 03 12:51:33 pc01 keyd[735]: CONFIG: parsing /etc/keyd/default.conf
Jul 03 12:51:33 pc01 keyd[735]: Starting keyd v2.4.3 (5e4ef41)
Jul 03 12:51:33 pc01 keyd[735]: DEVICE: match 046d:4023 /etc/keyd/default.conf (Logitech Wireless Keyboard PID:4023)
Jul 03 12:51:33 pc01 keyd[735]: DEVICE: ignoring 046d:4054 (Logitech Wireless Mouse)
Jul 03 12:51:33 pc01 keyd[735]: DEVICE: ignoring 0fac:1ade (keyd virtual pointer)
And that's what's in the config:
[ids]
*
[main]
leftcontrol+leftalt+102nd = @
leftcontrol+leftalt+q = |
I frist tried with having rightalt+102nd and rightalt+q on the right side, yet that also doesn't result in anything. Sadly, keyd also doesn't write anything else to journalctl. What am I missing?
Can you confirm this behaviour on master? The output of keyd monitor after pressing some keys would also be useful.
but trying to set up keyd on another device with Kernel 6.9.7 (Debian Testing) results in no result.
Can you also clarify what you mean by this? Are you saying the keyboard is rendered unusable, or simply that the mappings don't take effect? Have you tried simpler mappings like a=b?
Can you confirm this behaviour on master?
I'm right now compiling 6.9.11 straight from sources. 6.10.1 didn't work, I wasn't even able to log in for whatever reason.
The output of
keyd monitorafter pressing some keys would also be useful.
That's working as supposed, no error messages.
Can you also clarify what you mean by this? Are you saying the keyboard is rendered unusable, or simply that the mappings don't take effect? Have you tried simpler mappings like
a=b?
Mapping just doesn't have any effect. When I'm trying with the self compiled kernel I'll see to trying that out too.
Ok, with 6.9.11, two things: It seems I had the lines the wrong way around. At least the replacement y=z remapped the z key to output y. But even changing it to
| = leftcontrol+leftalt+102nd
@ = leftcontrol+leftalt+q
didn't change the effects. So something with more complex layout replacement seems to fail. Also:
/usr/local/bin/keyd
CONFIG: parsing /etc/keyd/default.conf
ERROR: line 8: invalid key or action
ERROR: line 9: invalid key or action
Starting keyd v2.4.3 (ce1bab6)
DEVICE: match 0000:0006:bdb72f48 /etc/keyd/default.conf (Video Bus)
DEVICE: match 046d:4023:61f4c396 /etc/keyd/default.conf (Logitech Wireless Keyboard PID:4023)
DEVICE: match 046d:4054:949f8c25 /etc/keyd/default.conf (Logitech Wireless Mouse)
DEVICE: ignoring 0fac:1ade:d2b36ae6 (keyd virtual pointer)
No, the placement was correct - if y=z maps z to y, then your particular layout (outside of keyd) swaps what keyd calls z with y. The names that keyd use correspond to the names of keycodes in the en-US layout; use keyd monitor to check what the names are in your layout (yes, this is confusing :P)
As for the problem at hand, my assumption is that what you want to do does not correspond with your config. While leftcontrol+leftalt+102nd = @ is valid syntax, it is a chord (cf #320): it defines what happens when you strike those keys simultaneously. Did you mean to do this?:
[ids]
*
[main]
[control+alt]
102nd = @
q = |
If not, can you give an example of what you want to happen + the output of keyd monitor when you try it?
No, the placement was correct - if
y=zmapsztoy, then your particular layout (outside of keyd) swaps what keyd callszwithy. The names that keyd use correspond to the names of keycodes in the en-US layout; usekeyd monitorto check what the names are in your layout (yes, this is confusing :P)
Indeed a bit confusing
As for the problem at hand, my assumption is that what you want to do does not correspond with your config. While
leftcontrol+leftalt+102nd = @is valid syntax, it is a chord (cf #320): it defines what happens when you strike those keys simultaneously. Did you mean to do this?:[ids] * [main] [control+alt] 102nd = @ q = |
tried that, didn't work either
If not, can you give an example of what you want to happen + the output of
keyd monitorwhen you try it?
What I want to do is compensate for the lacking support of the QWERTZ keyboard layout. With that layout it's common to have @ as a third symbol on the q key and | as the third symbol on the key to the right of the shift key (and some more combinations). These can be accessed either with the right alt key (labeled "Alt Gr") or pressing both left ctrl+left alt - at least on Windows, maybe even on macOS (I know, in the config I wrote I had them backwards). Sadly nobody ever bothered supporting these on Linux, while it's a long-standing issue. Now the easiest way would be to just remap ctrl+alt to "alt gr", but that will break any shortcut like changing tty. So an @ in keyd monitor would look like this:
keyd virtual keyboard 0fac:0ade:51e7301d leftcontrol down
keyd virtual keyboard 0fac:0ade:51e7301d leftalt down
keyd virtual keyboard 0fac:0ade:51e7301d q down
and the pipe accordingly:
keyd virtual keyboard 0fac:0ade:51e7301d leftcontrol down
keyd virtual keyboard 0fac:0ade:51e7301d leftalt down
keyd virtual keyboard 0fac:0ade:51e7301d 102nd down
I've now changes the config to
[ids]
*
[main]
[leftcontrol+leftalt]
102nd = |
q = @
But that won't do its job either. With the shortcut for pipe, if I run that e.g. in a terminal, it will jump to the first (oldest) entry of the bash history, while the @ shortcut doesn't seem to do anything (noticeably).
[ids] * [main] [control+alt] 102nd = @ q = |tried that, didn't work either
This works for me on the latest version. Be aware that @ will produce S-2, which assumes a qwerty display server keymap. If you are using another keymap you will need to explicitly map the desired keys.
[ids] * [main] [control+alt] 102nd = @ q = |tried that, didn't work either
This works for me on the latest version. Be aware that
@will produceS-2, which assumes a qwerty display server keymap. If you are using another keymap you will need to explicitly map the desired keys.
I don't, I have a QWERTZ layout. So how would I write it so that ctrl+alt+q will result in the @ symbol? Sure, I see that I confused the lines, but technically that should just have resulted in a pipe instead, but as explained, nothing happened.
Of course if the config itself is correct, I can report back later from using keyd with 6.12.6 and see if that does work.
I don't, I have a QWERTZ layout. So how would I write it so that ctrl+alt+q will result in the @ symbol?
You need to use the equivalent key positions on a qwerty board. Just press whatever sequence produces @ in your keymap and observe the output of keyd monitor. Then map that sequence of keys.
I don't, I have a QWERTZ layout. So how would I write it so that ctrl+alt+q will result in the @ symbol?
You need to use the equivalent key positions on a qwerty board. Just press whatever sequence produces
@in your keymap and observe the output ofkeyd monitor. Then map that sequence of keys.
I don't think I fully understand.
So, when it comes to @, I can either be accessed by leftcontrol+leftalt+q or by rightalt+q, at least on Windows. On Linux, only the latter is working, so I want to have the primary output what the latter does.
So I've changed the config to this:
[ids]
*
[main]
leftcontrol+leftalt+102nd = rightalt+102nd
leftcontrol+leftalt+q = rightalt+q
and those are the keycodes keyd monitor gives me. The 102nd key is where <, > and | are located on a QWERTZ keyboard. The access dilemma for | on Linux is identical to the issue with @. So technically this config should theoretically work, if I understand you correctly? But the keyd service gives me
ERROR: line 6: invalid key or action
ERROR: line 7: invalid key or action
And the same errors appear when changing the config to
[control+alt]
102nd = rightalt+102nd
q = rightalt+q
So what am I doing wrong?
rightalt+102nd is not valid. You want G-q. Please see the man page for more details.
rightalt+102ndis not valid. You wantG-q. Please see the man page for more details.
It would be helpful if the man page wasn't that extremely confusing.
I've now evolved my config to this, to change the layout of keyd to de first:
[ids]
*
include layouts/de
[global]
default_layout = de
Now the question is how to modify the de layout. Because what in theory I'd really need would be to map all key combinations that have been defined by the default Linux key layout to altgr to also be accessible with leftcontrol+leftalt, without remapping leftcontrol+leftalt to altgr, as that would break other stuff.
The de file currently only as @ defined under [de_altgr:G] as q = @, but there isn't a definition for | yet. So would I need something like
[de:main]
leftcontrol+leftalt = layer(de_control+de_alt)
[de_control+de_alt]
q = @
102nd = |
But that will just give me
line 193: de_control+de_alt is not a valid layer
line 194: de_control+de_alt is not a valid layer
keyd operates at the level of the keycode, not at the level of the keysym (which is a display server concept).
Unicode support works by emitting macros in the shipped XCompose file. This isn't a perfect solution since many applications have broken XCompose support.
If you plan on using a non-english keymap and want to leave it mostly unmodified, the best way to proceed is to set the layout in your display server and then do any auxiliary mappings in keyd by looking at the output of keyd monitor and mapping it to the scancodes your board emits.
So, if your main goal is simply to remap leftcontrol + leftalt to rightalt (altgr) with a german layout,
set de as your layout in your display manager, and then add something like the following
[alt]
leftcontrol = swap(custom-altgr)
[control]
leftalt = swap(custom-altgr)
[custom-altgr:G]
q = <sequence which produces @, observed as observed in the output of keyd monitor>
# altgr overrides...
If you plan on using a non-english keymap and want to leave it mostly unmodified, the best way to proceed is to set the layout in your display server and then do any auxiliary mappings in keyd by looking at the output of keyd monitor and mapping it to the scancodes your board emits.
That's exactly what I'm trying to do the whole time. That's how the lines rightalt+q and rightalt+102nd came to be, because those are the keycodes which combined are currently creating the @ and | signs (as in the altgr key is shown as rightalt by keyd monitor), but those are deemed invalid.
So, if your main goal is simply to remap
leftcontrol + leftalttorightalt(altgr)
Sadly that's not an option, as this will break other functionality like leftcontrol+leftalt+F3 to switch to the third tty. If you encounter some issue where you need to restart your window manager from cli because your desktop is frozen, you'll really miss that ability. Hence my complicated ways of trying to get leftcontrol+leftalt+q do the same thing as rightalt+q.
Sadly that's not an option, as this will break other functionality like leftcontrol+leftalt+F3 to switch to the third tty.
I assumed your goal was to have leftcontrol+leftalt behave as altgr in the general case. If you just want to override select combinations, without affecting control+alt more generally, you can modify the above config like so:
[alt]
leftcontrol = swap(custom-alt-control)
[control]
leftalt = swap(custom-alt-control)
[custom-alt-control:C-A]
q = <sequence which produces @, observed as observed in the output of keyd monitor>
# altgr overrides...