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

feat: implements mouse control support for MacOS #1035

Merged
merged 2 commits into from
Jun 2, 2024

Conversation

Kircheneer
Copy link
Contributor

Describe your changes. Use imperative present tense.

Implemented mouse control support for MacOS.

Checklist

  • Add documentation to docs/config.adoc
    • N/A - already in
    • Updated known issues for platforms
  • Add example and basic docs to cfg_samples/kanata.kbd
    • N/A - already in
  • Update error messages
    • Yes
  • Added tests, or did manual testing
    • Yes

@Kircheneer Kircheneer force-pushed the macos-mouse-control branch 2 times, most recently from 93ae887 to 2da27c2 Compare May 14, 2024 08:51
@nightscape
Copy link
Contributor

I just tried this, great job!
Mouse movement and mrgt work without issues, but mlft does not click.
@Kircheneer same for you?

@Kircheneer
Copy link
Contributor Author

I plan to address @nightscape's comments, just haven't had a lot of time to check yet.

@Kircheneer
Copy link
Contributor Author

I have tried with the following config:

(defsrc
e
)

(defalias
e mlft
)

(deflayer default
@e
)

and this worked flawlessly. Can you share what config you are on maybe?

@nightscape
Copy link
Contributor

nightscape commented May 28, 2024

@Kircheneer I just tried again with your configuration and I'm still observing the same behaviour:
I can click on certain things, e.g. the Mac OS Menu Bar, but not others, e.g. to change a tab in iTerm.
Do you have iTerm installed? If so, could you try switching tabs using the mlft?

@jtroo
Copy link
Owner

jtroo commented Jun 2, 2024

I think this PR is OK to merge as-is, but please do file a bug with investigation notes

@jtroo jtroo merged commit aa90c20 into jtroo:main Jun 2, 2024
4 checks passed
eugenesvk pushed a commit to eugenesvk/kanata that referenced this pull request Jun 9, 2024
@molnarg
Copy link

molnarg commented Jun 19, 2024

This is awesome, thanks for implementing it. I have come across problem though, when testing it. Somehow the left mouse action trigger a weird click that doesn't work in all apps on all buttons/surfaces, and it can't do e.g. drag and drop. Any idea why that could be?

@Kircheneer
Copy link
Contributor Author

Yeah @nightscape also hinted there were a couple of remaining problems, unfortunately I lack the API knowledge to properly troubleshoot this

@molnarg
Copy link

molnarg commented Jun 20, 2024

Looks like there's a second property we might need to set on the emitted event besides mouseType, called mouseButton, see https://developer.apple.com/documentation/coregraphics/cgevent. There's also a code sample at https://programmersought.com/article/20392219070/ that sets that to simulate a click. I might give it a try later if you don't have time for it.

@nightscape
Copy link
Contributor

I created a PR that fixes left mouse clicks for me: #1122
Can you give it a try @Kircheneer @molnarg ?

@molnarg
Copy link

molnarg commented Jun 21, 2024

It does work for me, thanks for implementing it!

It looks like in macos, things like double click and drag and drop are handled specially at this API level though and will need more work - two left clicks with the keyboard don't trigger a double click, or click+move+release doesn't trigger a drag and drop. :( But, now it's usable for most of the day-to-day basic mouse tasks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants