mooz / xkeysnail

Yet another keyboard remapping tool for X environment
891 stars 112 forks source link

multipurpose_modmap ctrl+click #96

Open davidsu opened 4 years ago

davidsu commented 4 years ago

I have the following configuration

define_multipurpose_modmap(
    Key.LEFT_CTRL: [Key.ESC, Key.LEFT_CTRL]}
)

My problem is that ctrl+click doesn't work, I suppose it's sending esc+ctrl, is there a way to fix this?

amosbird commented 4 years ago

Same problem here. The root cause may be that device.grab() completely hijack modifiers from the userland application. https://github.com/amosbird/xkeysnail/commit/1f280237e6946dc12ac84fbf1aae7fdf89a2a531

pat-flew commented 4 years ago

This is likely because the multipurpose handler doesn't send the modifier press event when the press-down timer has elapsed but instead alongside the next keypress. As it is, xkeysnail is responding passively to each individual keypress and there's no timer to handle period-dependant events.

amariusz commented 3 years ago

That's a pity! I thought I had found great xcape replacement until I run into this issue. This behaviour effectively breaks ctrl+click. I hope someone will figure out solution for this.

joshgoebel commented 2 years ago

This is a hard one because a press and release means it's ESC and it's only Ctrl when paired with another event. Do you have a discrete mouse? Did you try adding it to xkeysnail so that it's clisk would count as keyboard events? If the mouse events were flowing into xkeysnail then a click should count and result in LEFT_CTRL being asserted on the output.

amariusz commented 2 years ago

Hi, @joshgoebel

I'm not sure what you mean by discrete mouse. If I remember correctly I haven't used any device specific rules in config file. In the meantime I've found that https://gitlab.com/interception/linux/tools project suits my needs in case xcape would stop working at some point in the future.

For the current moment I'm good with solutions I have.

Thanks!

joshgoebel commented 2 years ago

I'm not sure what you mean by discrete mouse.

I mean a separate pointing device that's not part of the keyboard... if so you'd have to add it to xkeysnail explicitly so that it can see your click and know that it should then apply the modifier - and not keep waiting for another keyboard key.

If you've moved on and are happy, could you close this issue?

amariusz commented 2 years ago

In that case I'm using discrete mouse :)

Do you have a link for sample configuration file that adds mouse to xkeysnail, in case someone reading this thread want to try it out?

I don't think I'm able to close the issue - it was open by @davidsu.

joshgoebel commented 2 years ago

You'd look up your mouse device (or name) and use the --device command line option to include it.