AminSallah / Flow.Launcher.Plugin.WinHotkey

12 stars 3 forks source link

Three finger gesture tap triggers flow #6

Open jjw24 opened 6 months ago

jjw24 commented 6 months ago

Hey how's it going?

Would you know why when I use my three-finger tap gesture on my touchpad it would trigger flow as well? I know some laptops the gesture does trigger the Windows Search, but my gesture already assigned to a different keyboard shortcut.

Machine: Win 10

Repro:

  1. After installing this plugin
  2. On a device with touchpad, assign the three-finger tap gesture to Ctrl + W
  3. Use the gesture on a browser tab, and observe that the keyboard shortcut Ctrl + W activates and the tab is closed but flow pops up as well.

Not sure if same case on a Win 11 laptop. Let me know if you can repro.

Cheers

AminSallah commented 6 months ago

Hey @jjw24, thank you for the detailed report. I believe the Remap Windows gesture engine still simulates the Win key, then blinds it, upon which the plugin relies on timeout to determine whether to trigger or not. This update should address this issue. On my machine, it worked well with the default three-finger tap gesture and didn't trigger Flow Launcher. However, I can't remap the touchpad gesture, so I'm unable to test it in this case. Let me know if the issue is resolved with your custom gesture shortcut.

If you have Python installed, you can test this script instead. It triggers the flow using Alt+Space and also print which keys are used when the tap gesture is observed. This will be more helpful in case the issue persists.

import keyboard

class Remapper():
  def __init__(self) -> None:
    self.last_press_e = None
    keyboard.on_press(self.handle_press)
    keyboard.on_release_key('left windows', self.handle_lw_release, True)
    keyboard.wait()

  def handle_press(self, e: keyboard.KeyboardEvent) -> None:
    self.last_press_e = e
    print(f"Key pressed: {e.name}")

  def handle_lw_release(self, e: keyboard.KeyboardEvent) -> None:
    keyboard.send('ctrl') # prevent start menu 
    keyboard.release('left windows')
    if self.last_press_e.name == 'left windows':
      print('simulate alt+space')
      keyboard.send('alt+space')

Remapper()

Edit: Disable WinHotkey plugin before running the python script

jjw24 commented 6 months ago

Hey thanks for the quick update. I havent had a chance to play with the Python script. I did try out the new release and it seems for me it does resolves the issue partially. What I am finding is that when I use the three finger gesture on touchpad it works as intended, but it seems the the Win key is not released, so on the next keypress it combines with the Win key.

To repro:

  1. Update the plugin
  2. Use the three finger gesture on touchpad
  3. Observe it works as configured
  4. Press the keyboard key 6 or r and see when 6 is pressed it minimises your window, or triggers the Windows/flow Run command on pressing r. Triggering flow again with Win key will cancel the above point 4 behaviour.

Let me know if you are able to repro.

AminSallah commented 6 months ago

648dcdf resolves the issue. Please let me know if it is working in your case.

jjw24 commented 6 months ago

Hey, just been test driving the fix, I am still finding it does occasionally still triggers non-gesture related windows functionality. For my win 10 machine it triggers the snip it tool and for win 11 it's the monitor display toggle.

It's not reproducible everytime but does happen during 1 in 10 uses of my three finger gesture on touchpad. Let me know if you can reproduce on your end.

AminSallah commented 6 months ago

I still can't reproduce this. I've tried it on both Windows 10 and Windows 11. Also, nothing comes to mind regarding what might be causing this bug, which makes me wonder if it's originating from the plugin. However, there's a new release coming that checks if Windows UI elements are currently focused (including projection options). It will close them before triggering the flow, so this may help in the case of Windows 11.

boromyr commented 5 months ago

I also have problems with the three-finger touch. When I activate the plugin and touch with three fingers, the touchpad remapped to ctrl + r sends win + p, trying again then sends win + r, then crashes explorer and restarts every 3 touches.

EDIT: versions 3.0, 3.3, and 3.4 also have the same issue.

jjw24 commented 5 months ago

Hmm been testing on Win 11 laptop with v4, definitely happening less, but 1 out of 15 taps result in the windows start menu been triggered.

Yeah I understand this kind of issue is hard to troubleshoot, especially if you can't repro it.