pablopunk/SwiftShift

Some shortcut combinations make one of them not to work

Closed this issue · 9 comments

Same issue here - M1 Macbook Air on latest version

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

@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

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.

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) 
 } 

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.

@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

Works great @pablopunk ! Thanks for the fix!

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