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

🐞 Pressing one of two required key to activate Loop wrongly activate Loop if pressed just after switching space. #615

Open
3 of 4 tasks
Write opened this issue Nov 14, 2024 · 2 comments
Labels

Comments

@Write
Copy link

Write commented Nov 14, 2024

Bug Description

Sorry for horrible title.

I have my loop mapped to ctrl(^) & cmd. Switching to space 1, is mapped to ^1, and so on for 2nd and 3rd space.
Pressing and releasing instantly ^2 to switch to space 2, THEN pressing cmd to do something wrongly activate Loop.
This doesn't occure when NOT switching space : for example, pressing ctrl, releasing it then pressing cmd DOESN'T activate loop, unless you just switched space.

Bug occurs with both 0.0 and 0.1 delay, I haven't tried more delay.

Steps To Reproduce

  1. Bind ^1 to Space 1 and ^2 to Space 2
  2. Bind loop to ^ and cmd
  3. Switch from Space 1 to Space 2 with ^2
  4. press cmd immediately after space is switched and move the mouse around, Loop will activate as if ctrl was still pressed.

Expected Behavior

  1. Bind ^1 to Space 1 and ^2 to Space 2
  2. Bind loop to ^ and cmd
  3. Switch from Space 1 to Space 2 with ^2
  4. press cmd wouldn't activate Loop since ctrl is released.

Actual Behavior

As stated in Step To Reproduce.

Screenshots

No response

macOS Version

15.1

Loop Version

Version 🧪 1.2.0 (1380)

Additional Context

No response

Final Checks

  • My issue is written in English
  • My issue title is descriptive
  • This is a single bug (multiple bugs should be reported individually)
  • I can help with fixing or developing this issue (tick if you can help).
@Write Write added the Bug label Nov 14, 2024
@MrKai77
Copy link
Owner

MrKai77 commented Nov 15, 2024

Very interesting! I suspect that this has a common cause with #372.

I found out that this is happening as during a space switch, macOS takes full control of keypress events, effectively blocking Loop from being able to detect the trigger key during that specific period of time.

This will get a little technical but, I found a way around this, which was to use a CGEvent key event handler instead of the current NSEvent handler. A CGEvent handler captures key events at the system-level, while a NSEvent handler captures them at an app-level. It worked, but also caused many unwanted side-effects. With that said, I am quite sure that this is possible to solve with a little more tinkering, so thanks for reporting!

@Write
Copy link
Author

Write commented Nov 26, 2024

If there's anything I can do (using a test build for some time, etc.) you can reach to me anytime.

Cheers, and thanks for your hard work.

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

No branches or pull requests

2 participants