keyd icon indicating copy to clipboard operation
keyd copied to clipboard

Is it possible to remap keys with multiple modifiers from the cli?

Open Vosjedev opened this issue 1 year ago • 4 comments

I am trying to bind ctrl+alt+shift+f1 up to ctrl+alt+shift+f9 to new bindings using keyd-application-mapper. Because my mappings did not work, I started trying to do it manually from the cli, with the following results:

$ keyd bind control.alt.shift.f1=kp1
alt.shift.f1 is not a valid key or alias

So I tried something else, but without success:

$ keyd bind control+alt+shift.f1=kp1
control+alt+shift is not a valid layer

Would something like this (basically remapping keys with multiple modifiers using keyd bind) be possible?

Vosjedev avatar Aug 06 '24 06:08 Vosjedev

I think this is possible, but not in the way you are doing it. In your ~/.config/keyd/app.conf, you can use the layers defined in /etc/keyd/default.conf

Here is an excerpt from my configuration. Note that primary_layer is a custom layer I created.

[firefox*]

# Go backward/forward in history
alt.h = C-[
alt.l = C-]

# New private window
capslock+shift.n = C-S-p

# Rearrange tabs
capslock.[ = C-S-pageup
capslock.] = C-S-pagedown

# Open search bar
primary_layer.k = C-k

qadzek avatar Aug 06 '24 19:08 qadzek

Thanks, but I don't really understand how you would trigger that layer... Also, I guess capslock is also a layer, and this part shows two layers with a +:

# New private window
capslock+shift.n = C-S-p

Isn't that what I am searching for? How does that work?

Vosjedev avatar Aug 08 '24 08:08 Vosjedev

I guess capslock is also a layer,

You are right.

Isn't that what I am searching for?

It seems pretty close to what you are looking for, which is why I included it in my excerpt.

Hopefully, a more experienced user can help you further.

I only managed to create my configuration after a lot of trial and error. I recommend starting simple. For example, don't immediately try to remap ctrl+alt+shift+f1; instead, try remapping ctrl+f1 first. Once that works, add a modifier.

Don't start mapping to a complex binding either, start by binding to a simple letter.

Note that the [firefox*] part in ~/.config/keyd/app.conf is very important too. Make sure it is actually being matched.

qadzek avatar Aug 12 '24 14:08 qadzek

@Vosjedev Layers must be defined in /etc/keyd/*.conf. If you do the following, you can use it in ~/.config/keyd/app.conf like HYPER.a = b.

# /etc/keyd/keyd.conf
[HYPER:S-C-A-M]
esc = clear()

tkna91 avatar Sep 13 '24 17:09 tkna91

Sorry for the very late response. I eventually solved it using a device-specific remap and some aliases. Thanks for the help, this information could be usefull in the future.

Vosjedev avatar Oct 26 '24 12:10 Vosjedev

The correct way to solve this is to use composite layers.

That is:

[control+alt+shift]

f1 = <action>

Please see the man page for more details.

rvaiya avatar Dec 29 '24 00:12 rvaiya