rvaiya / keyd

A key remapping daemon for linux.
MIT License
2.56k stars 156 forks source link

Application Mapper: Macro to press shift twice not working. #746

Open voronind-com opened 2 months ago

voronind-com commented 2 months ago

Greetings! I love keyd so much, thank you! In JetBrains IDEs by default you can press leftshift twice to Search Everywhere. However, I struggle to create a macro that presses left shift twice. I've tried macro(leftshift 10ms leftshift) and macro(S-leftshift) with no luck. Any idea how to do this? I also do this in application-mapper. Thanks!

Edit: I'm on NixOS with Sway 1.9 and Keyd v2.4.3. Config bellow.

argenkiwi commented 2 months ago

I've faced a similar issue this week. I use One-shot shift and tapping left shift does not produce any effect as the shift layer is bound to left shift specifically. Try doing left then right shift or vice versa.

voronind-com commented 2 months ago

Try doing left then right shift

Thanks for the idea, but it didn't work for me.

argenkiwi commented 2 months ago

That is certainly strange. I have just tested it on Android Studio (based on IntelliJ) and it worked for me.

[main]
leftshift = macro(rightshift leftshift)

Maybe there is some other issue.

voronind-com commented 2 months ago

That is certainly strange. I have just tested it on Android Studio (based on IntelliJ) and it worked for me.

[main]
leftshift = macro(rightshift leftshift)

Maybe there is some other issue.

Maybe it works for you because you have bind it to left shift, so it triggers the left shift and then your macro?

I have no idea, I've tried your example with no luck. Checked everything.

Do you write that to your system keyd service or keyd-application like me?

argenkiwi commented 2 months ago

Not sure what you mean by running keyd as a service or application. I do run keyd as a service with runit (not systemd).

Just to make sure I tried all of the following:

[main]

f1 = macro(leftshift leftshift)
f2 = macro(rightshift rightshift)
f3 = macro(leftshift rightshift)
f4 = macro(rightshift leftshift)

[shift]

f1 = macro(leftshift leftshift)
f2 = macro(rightshift rightshift)
f3 = macro(leftshift rightshift)
f4 = macro(rightshift leftshift)

They all work as expected running v2.4.3. My guess would be there is something conflicting with this macro in your config. I would make a separate config with just the macro to isolate the issue. But unless you share your config it will be hard to know what's wrong.

voronind-com commented 2 months ago

@argenkiwi yes that means you're using system-wide config. Keyd has a separate module called keyd-application-mapper that can map keys per-application, not for everything. Its configuration goes to ~/.config/keyd/app.conf

voronind-com commented 2 months ago

This is my system config:

[ids]
*

[layer_alternative]
a=home
c=copy
d=end
h=left
j=down
k=up
l=right
s=pagedown
v=paste
w=pageup
x=cut

[layer_control]
a=back
d=forward
e=nextsong
q=previoussong
s=volumedown
space=playpause
w=volumeup
x=mute
z=stopcd

[layer_macro]

[main]
backspace=delete
capslock=overload(control, esc)
compose=layer(layer_macro)
esc=print
leftcontrol=overload(layer_alternative, leftcontrol)
rightcontrol=layer(layer_control)
rightshift=backspace

This is per-app config for Idea:

[jetbrains-idea-ce]
alt.a = C-A-5
alt.c = C-S-A-t
alt.d = S-f9
alt.e = A-right
alt.f = C-S-f
alt.g = macro(gd)
alt.o = C-o
alt.q = A-left
alt.r = S-f10
alt.s = C-A-s
alt.v = C-q
alt.x = C-f4
alt.z = C-f2
alt.space = macro(rightshift leftshift)