rvaiya/keyd

Cancel oneshot on leftclick

Closed this issue ยท 5 comments

This happens very frequently for me

  • I am on firefox browser
  • I want to select some text
  • I select first word
  • press shift and release (and not hold shift)
  • click the end of my selection
  • press control + c to copy
  • devtools open up instead of copying because shift is still pressed because of oneshot

if we can have an option to cancel oneshot on mouse clicks that would be amazing!

thank you

If you have your mouse in your [ids], you could do this:

[main]
leftshift = overload(shift, oneshot(shift_prime))

[shift_prime:S]
leftmouse = leftmouse
middlemouse = middlemouse
rightmouse = rightmouse

@nsbgn thank you so much! it works!

I made the shift_prime have only a leftmouse mapping but still shift was cancelled on rightmouse and middlemouse.

it's fine, but out of curiosity how can I make it only cancel shift when I leftmouse click

Edit: it actually didn't work.

it cancels the shift before cancelling the leftmouse

resulting in text not being selected.

this is what's happening now

I am on firefox browser
I want to select some text
I select first word
press shift and release (and not hold shift)
click the end of my selection
nothing happens, it's not selecting any text
as if shift is being released before leftmouse is being clicked (that's exactly what shows in `keyd monitor`)

image

Ah, I misunderstood. I interpreted 'cancelling the oneshot on left click' as cancelling it before the left click; if you meant to cancel it after the left click, you can put leftmouse = S-leftmouse instead (or simply keep the mouse in your [ids], without additional configuration).

That works! thank you @nsbgn

I appreciate you

musjj commented
I'm having the same problem, but with meta keys. This is my config:
[ids]
*

[main]
meta=overload(meta, oneshot(meta_prime))

[meta_prime:M]
leftmouse=M-leftmouse
middlemouse=M-middlemouse
rightmouse=M-rightmouse

After pressing the meta key and clicking with my left mouse button, the meta key still stays down until I press another keyboard key. Is there a way to fix this?

Oh it looks that you need to add the mouse ID manually (* only captures keyboard) by obtaining them via keyd monitor. Now meta=oneshot(meta) works as-is without any additional configuration.