JoseExposito / touchegg

Linux multi-touch gesture recognizer
GNU General Public License v3.0
3.62k stars 167 forks source link

Adding environment variables to RUN_COMMAND to distinguish between input device types #597

Closed ichaoX closed 2 years ago

ichaoX commented 2 years ago

Is your feature request related to a problem? Please describe

Many programs are optimized for touchscreen and I want to specify different behavior for touchscreen and touchpad, but currently it is difficult to distinguish between input sources.

When the touchscreen gesture is turned off

xsetwacom set "Wacom HID 524D Finger touch" Gesture off
  1. Some programs such as firefox, krita, support two-finger pinch zoom, the effect of SendKeys way is not as smooth as the native operation, and enable SendKeys will destroy the native operation experience.

  2. GNOME Shell 41.2 with 3 and 4 fingers swipe left and right is fixed to switch workspaces, X11Gestures(Version 14) extension also can not set it, if touchegg enabled 3 fingers tile a window, the two operations will happen together.

touchegg.conf

    <gesture type="PINCH" fingers="2" direction="IN">
      <action type="SEND_KEYS">
        <modifiers>Control_L</modifiers>
        <keys>KP_Subtract</keys>
        <repeat>true</repeat>
        <decreaseKeys>KP_Add</decreaseKeys>
      </action>
    </gesture>
    <gesture type="PINCH" fingers="2" direction="OUT">
      <action type="SEND_KEYS">
        <modifiers>Control_L</modifiers>
        <keys>KP_Add</keys>
        <repeat>true</repeat>
        <decreaseKeys>KP_Subtract</decreaseKeys>
      </action>
    </gesture>
    <gesture type="SWIPE" fingers="3" direction="RIGHT">
      <action type="TILE_WINDOW">
        <direction>right</direction>
      </action>
    </gesture>
    <gesture type="SWIPE" fingers="3" direction="LEFT">
      <action type="TILE_WINDOW">
        <direction>left</direction>
      </action>
    </gesture>

Describe the solution you'd like

Provide DeviceType to external commands via environment variables, and the external command determines the actual operation. For example: DEVICE_TYPE=TOUCHSCREEN

Describe alternatives you've considered

It would also be nice to be able to set the <deviceType> in a configuration file, but this can be more complicated and less flexible.

JoseExposito commented 2 years ago

This could be a great feature to have. However, it'd involve too much work for a "niche" feature. "Niche" because most users don't have a touchscreen and a touchpad.

This would require changes in Touchégg to implement the feature, Touché, requiring a complete UI redesign and the X11 GNOME Shell extension and Gala due to protocol changes.

I think that it could be awesome to have this, but I don't have the time/energy to implement it.

Of course, if someone else volunteers to do the job I'd be happy to review their code.