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

Some shortcut combinations make one of them not to work #12

Closed
pablopunk opened this issue Dec 30, 2023 · 9 comments
Closed

Some shortcut combinations make one of them not to work #12

pablopunk opened this issue Dec 30, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@pablopunk
Copy link
Owner

CleanShot 2023-12-30 at 20 18 37@2x

@pablopunk pablopunk changed the title Using ⌥ Option for a shortcut will make the other one not work Some shortcut combinations make one of them not to work Dec 31, 2023
@Bryceshaw06
Copy link

Same issue here - M1 Macbook Air on latest version

@pablopunk pablopunk added the bug Something isn't working label Jan 1, 2024
@pablopunk
Copy link
Owner Author

@Bryceshaw06 @xezrunner Can you guys try v0.10.0? Let me know if the issues are fixed :)

@Bryceshaw06
Copy link

@pablopunk It did not fix it for me. I am on the latest version, and the commands I'm trying to use are "Command" for "Move" and "Alt+Command" for "Resize". https://share.cleanshot.com/wGq9Jxst

@pablopunk pablopunk reopened this Jan 3, 2024
@xezrunner
Copy link

xezrunner commented Jan 3, 2024

Can confirm that there still is a shortcut overlap problem.

Screen.Recording.2024-01-03.at.07.35.10.mov

However, on Ventura, the shortcuts now work as expected when screen recording as well, was broken in the first few versions.

@pablopunk pablopunk self-assigned this Jan 3, 2024
@pablopunk
Copy link
Owner Author

This seems to be a different issue to the one I solved (which was just triggering both actions at the same time, so one would shadow the other one).

This one only happens when one shortcut contains the other one (⌘⇪ contains ⌘) but I'm having a hard time fixing the code.

if event.modifierFlags.isDisjoint(with: shortcut.modifierFlags) {
MouseTracker.shared.stopTracking(for: action)
} else if event.modifierFlags.contains(shortcut.modifierFlags) {
MouseTracker.shared.startTracking(for: action)
}

Both shortcuts pass the second check because ⌘⇪ contains ⌘, so I think by inverting the check (⌘ contains ⌘⇪) it should work but the AlgebraSet might not work as I think 😅, cause this makes no shortcut to be triggered:

 if event.modifierFlags.isDisjoint(with: shortcut.modifierFlags) { 
     MouseTracker.shared.stopTracking(for: action) 
-} else if event.modifierFlags.contains(shortcut.modifierFlags) { 
+} else if shortcut.modifierFlags.contains(event.modifierFlags) { 
     MouseTracker.shared.startTracking(for: action) 
 } 

@pablopunk
Copy link
Owner Author

Well I asked ChatGPT and it completely solved the issue by using something I didn't know about (converting the events using .deviceIndependentFlagsMask). Should have done that much earlier.

@pablopunk
Copy link
Owner Author

@xezrunner @Bryceshaw06 Please check out the latest release and see if the issue is finally fixed 🙏🏻 https://github.com/pablopunk/SwiftShift/releases/tag/0.13.0

@Bryceshaw06
Copy link

Works great @pablopunk ! Thanks for the fix!

@xezrunner
Copy link

Can also confirm that the issue is now fixed - shortcuts no longer overlap if both use the same key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants