Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double click not working (Kaldi, OSX) #368

Open
denvaar opened this issue Aug 5, 2022 · 4 comments
Open

Double click not working (Kaldi, OSX) #368

denvaar opened this issue Aug 5, 2022 · 4 comments
Assignees
Labels
Error Unexpected replicated behavior MacOS Issue regarding Apple PC OS

Comments

@denvaar
Copy link

denvaar commented Aug 5, 2022

Single click Mouse actions work great, however I cannot get a double click to work. For example, I'd like to hover the cursor over a word and use the double click action to select it. This seems like a bug to me, but maybe I'm doing something wrong.

Mouse("left:2")

I've tried many variations, like adding a pause, or chaining two single click mouse actions together, but nothing seems to do the trick. There is no error in the console either.

I use Kaldi engine and I'm on macOS Monterey Version 12.4 (Macbook pro)

Thanks for the help.

@drmfinlay
Copy link
Member

Hello Denver,

Thank you for reporting this problem. It is indeed a bug with the library. It looks like scrolling is broken on macOS too. I'll have both fixed in the next version. That may be some time off, however.

In the meantime, the following code will allow you to double click:

from dragonfly import MappingRule, CompoundRule, Function

# pynput is the input library Dragonfly uses on macOS and should
#  be installed already.
from pynput.mouse import Controller, Button

controller = Controller()

def left_click(n):
    controller.click(Button.left, n)


# Invoke the `left_click' function when "double click" is spoken.
# With a `MappingRule',
class DoubleClickRule1(MappingRule):
    mapping = {
        "double click": Function(lambda: left_click(2)),
    }

# or `CompoundRule'.
class DoubleClickRule2(CompoundRule):
    spec = "double click"
    def _process_recognition(self, node, extras):
        left_click(2)

Triple click is broken too. Invoke the left_click function with 3 instead to triple click.

Hope this helps!

@drmfinlay drmfinlay self-assigned this Aug 10, 2022
@drmfinlay drmfinlay added Error Unexpected replicated behavior MacOS Issue regarding Apple PC OS labels Aug 10, 2022
@denvaar
Copy link
Author

denvaar commented Aug 11, 2022

Thanks @Danesprite 👍

@drmfinlay
Copy link
Member

No problem. I should have these bugs fixed soon.

drmfinlay added a commit that referenced this issue Sep 12, 2022
Re: #368.

The Mouse action class can now be used to double/triple click, and
scroll the mouse wheel, on macOS.
drmfinlay added a commit that referenced this issue Sep 12, 2022
Re: #368.

The Mouse action class can now be used to double/triple click, and
scroll the mouse wheel, on macOS.
@drmfinlay
Copy link
Member

This is fixed on the master branch. There is one limitation though. Double-click and triple-click will only work when the repeat syntax is used:

{
   "double click": Mouse("left:2"),
   "triple click": Mouse("left:3")
}

The following will not work properly on macOS:

Mouse("left, left").execute()
Mouse("left, left, left").execute()

I'll make another comment, and close this issue, after the next release version is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Unexpected replicated behavior MacOS Issue regarding Apple PC OS
Projects
None yet
Development

No branches or pull requests

2 participants