JoseExposito / touche

The desktop application to configure Touchégg
GNU General Public License v3.0
551 stars 26 forks source link

I need to Shift_L modify an application button release event #58

Closed dlarue closed 2 years ago

dlarue commented 2 years ago

Is your feature request related to a problem? Please describe

I don't think so but maybe a key release action is needed. See below:

UPDATE: I have since found out there are hotkeys to these frame buttons( Alt+r and Alt+Shift+r ). So I need to do a gesture which adds the Shift_L modifier to those hotkey combinations. Frame button = Shift_L Alt_L+r Rubberband button = Shift_L Alt_L+Shift_R+r

The LightBurn laser cutter application has the ability to "Frame" the laser cutter design before cutting and with a diode laser if you apply a Shift key modifier on the button click(actually the release) it will fire the laser in low power to visually see if the positioning is correct. There is a Frame box button and a Frame rubberband button which each require a Shift modifier to add the laser fire capability to the framing operation.

Best operation I can think of would be if this were possible: 2 finger tap triggers frame and 3 finger tap triggers rubberband framing.

Also, I can press and hold the Frame button, then press/hold a real keyboard Shift key and on button release the Frame does the diode low power fire.

It’s getting weird!

with a physical Keyboard: Alt-Shift+r does the rubberband AND fires the laser. Shift-Alt+r does the rubberband AND fires the laser… Alt+r does square frame, no laser I can’t get square frame AND laser with hotkeys but I should be able to get the rubberband with laser firing but NOooooo.

With Gestures 2 finger tap and 3 finger tap I record Shift_L+Alt_L+r which should trigger rubberband w/laser but it only does rubberband. Alt_L+Shift_L+r also just does rubberband with no laser. Alt_L+r does square frame as it should.

What's odd is that the 3 key gestures don’t trigger the laser and my guess is that it is because the first modifier(Shift) acts on the RELEASE of Alt+r and the gesture system does not have a release capability.

JoseExposito commented 2 years ago

Do you mind to share your configuration file? Placed at ~/.config/touchegg/touchegg.conf, append a .txt and upload it to GitHub, please.

Let's see what's going on under the hood....

dlarue commented 2 years ago

Here it is. I have defined for the lightburn app a 2 finger gesture and a 3 finger gesture just to be sure each is getting recognized. For the 2 finger gesture, Shift_L then Alt_L and r were pressed in that order but it stored Alt_L+Shift_L+r which is ok because I found out that when using the physical keyboard the same operation results from the two sequences. ie the laser fires and it does a rubberband type or frame around the design. But with the Touchegg gesture, I get only the rubberband framing and it does not fire the laser. I've also validated the keyboard operation does happen at the 'r' key press event and not the 'r' key release as it happens using the application GUI button which triggers the action on the button release.

touchegg.conf.txt

JoseExposito commented 2 years ago

Mmm ok, this is a little trade-off I had to introduce in Touché to make possible to use very popular shortcuts like Alt+Tab / Alt+Shift+Tab. The Shift key is moved to the keys section automatically.

However, in your particular case it doesn't work. I'd suggest to edit touchegg.conf manually and override this gesture:

    <gesture type="TAP" fingers="2" direction="UNKNOWN">
      <action type="SEND_KEYS">
        <modifiers>Alt_L+Shift_L</modifiers>
        <keys>r</keys>
        <repeat>false</repeat>
        <animation>NONE</animation>
        <on>begin</on>
      </action>
    </gesture>

Note that I moved Shift_L to the modifiers section.

While this is a bug, I can't fix it without breaking more used shortcuts... So unfortunately I have to leave like this :S

dlarue commented 2 years ago

I'll give it a shot but I feel I'd tried this manually before and it still did not work.

It still does not trigger the firing of the laser like when I do Alt+Shift+r on the keyboard. :/

Would you know why I get the gesture sends out the Alt-Shift-r and it is not the same as when sent from a keyboard? I believe the app is using the Qt framework and how we get the Linux support. I tried onscreen keyboards but they do Test Input on the keyboard action and just send out the text instead of injecting keys into the UI keystroke queue.

JoseExposito commented 2 years ago

Make sure that the config is still as in my example, Touché might override it (it's a bit of a pain :S)

Does this command work?

$ xdotool key alt+shift+r

Under the hood, Touchégg does something very similar to that. You can add a sleep to have time to focus the correct window:

$ sleep 3 && xdotool key alt+shift+r

If that happens to work, you can use the "run command" action instead of the shortcut one.

dlarue commented 2 years ago

Once I saw in a closed issue that you asked someone to use xev I tried that and was surprised to see all 3 inputs presenting the same keystrokes via xev. Touchegg, onboard keyboard and physical keyboard all show ^[R yet only the physical keyboard triggers the hotkey sequence in the Qt app( LightBurn ). I've been thinking that if I find something which works even I have to create a Qt app, or even a Qt Python script, just to run the keystrokes that the ability of Touchegg to run commands would be a possible solution.

I tried xdotool and it acted the same way as the others and only triggered the frame action but not the laser firing.

JoseExposito commented 2 years ago

xdotool should definitely work. It could be a Qt bug, but I think it is more likely that it is a problem in the LightBurn app.

I'd try to open a bug report on LightBurn's issue tracker with the xdotool command, maybe they can fix it.

Closing this issue, as it is not a bug on Touché. I hope the LightBurn devs can help you.