fix: robust global hotkey registration with informative conflict errors - #1292
Open
4Roman wants to merge 1 commit into
Open
fix: robust global hotkey registration with informative conflict errors#12924Roman wants to merge 1 commit into
4Roman wants to merge 1 commit into
Conversation
- Register each hotkey independently in the 'all' pass so a single conflict no longer disables the remaining hotkeys. - Clear stale state with unregister_all() before bulk (re)registration, plus force-unregister + retry per shortcut, fixing the 'already registered' desync left by unclean shutdowns/restarts/failed attempts. - Add a Windows conflict probe (hotkey_owner.rs) and surface an actionable, honest error; show a startup notification listing any failures. - Always re-grab the shortcut for pot when pressing OK in the Hotkey settings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a global hotkey fails to register, the current behaviour has a few rough edges:
?operator bailed on the first error, so a single conflicting/invalid binding silently disabled all the remaining hotkeys.Changes
"all"pass and collect failures, so one conflict no longer disables the others.unregister_all()before bulk (re)registration, plus force-unregister + a short retry per shortcut, fixing the "already registered" desync left by unclean shutdowns / restarts / failed attempts.hotkey_owner.rs) that classifies the failure (free / held by another app / OS error) and names the owner for well-known system shortcuts; the user-facing error and the startup notification now state exactly which hotkey failed and why.isRegisteredpre-check in the Hotkey settings so pressing OK reliably re-claims the shortcut for pot.Honest limitation
Windows exposes no public API to map a global hotkey back to its owning process, so for arbitrary third-party apps the message can only say "held by another application — pick a different combination". Only well-known OS shortcuts are named.