Skip to content

Restore shortcuts after user session switches - #1797

Open
culpen90 wants to merge 2 commits into
rxhanson:mainfrom
culpen90:fix/restore-shortcuts-after-user-switch
Open

Restore shortcuts after user session switches#1797
culpen90 wants to merge 2 commits into
rxhanson:mainfrom
culpen90:fix/restore-shortcuts-after-user-switch

Conversation

@culpen90

@culpen90 culpen90 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • release global shortcut bindings when the macOS user session becomes inactive
  • restore current WindowAction and Todo shortcut bindings after the session becomes active again
  • preserve inactive-session, ignored-app, and shortcut-recording guards across rebinding
  • add regression coverage for session transitions, duplicate notifications, delayed restoration, and state changes while inactive
  • keep Todo shortcuts unbound until both the user session is active and shortcut recording has ended

Root cause

MASShortcut retains the configured shortcut even when Carbon cannot register the corresponding global hotkey. With multiple logged-in user sessions, an inactive Rectangle process could keep those hotkeys registered, leaving the active user's shortcuts configured but nonfunctional.

Testing

  • xcodebuild test -quiet -project Rectangle.xcodeproj -scheme Rectangle -destination 'platform=macOS' -derivedDataPath /private/tmp/RectangleIssue351Conflict.X4sF3k -only-testing:RectangleTests/ShortcutManagerSessionTests -only-testing:RectangleTests/ShortcutRecordingObserverTests CODE_SIGNING_ALLOWED=NO (15 tests passed)
  • the remaining full-suite cooperative-resize failures reproduce unchanged on clean upstream 8db3e8e

Fixes #351

@culpen90
culpen90 marked this pull request as ready for review July 22, 2026 14:17
@rxhanson

Copy link
Copy Markdown
Owner

Thanks! Sorry for the delay on reviewing this one. Looks good, but a merge conflict popped up from a different PR that was merged. I'll have some time to untangle it this week if you don't have a chance to get to it.

@culpen90

Copy link
Copy Markdown
Contributor Author

Thanks — I resolved the conflict by merging the current main and preserving both the session-active and shortcut-recording guards in TodoManager. I also added coverage for both transition orderings. The focused tests pass (15/15), the GitHub build is green, and the PR is mergeable again.

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.

keyboard shortcuts are disabled after adding a second user account

2 participants