Skip to content

Do not let a hand edited key name take the tray down - #818

Merged
SimonCropp merged 1 commit into
mainfrom
fix-hotkey-key-parse
Aug 22, 2026
Merged

Do not let a hand edited key name take the tray down#818
SimonCropp merged 1 commit into
mainfrom
fix-hotkey-key-parse

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

KeyRegister parsed the key half of a hot key with Enum.Parse, unguarded, and
SettingsValidator only checked that it was non-empty. So "Key": "Ctrl+A" in
settings.json passed the "Cannot start" guard, which only covers reading the file,
and then threw ArgumentException out of ReBindKeys during startup - at every login,
until the file was deleted by hand.

Enum.Parse also reads the underlying number, so "Key": "1" silently bound the left
mouse button rather than the digit.

KeyName.TryParse is the one reader now. It rejects numbers and flag lists before
parsing and accepts aliases, which is why it is not a round trip through ToString:
Keys gives several values two names and prints the other one, so "Enter" would have
been rejected. A key it cannot read leaves that hot key unbound and the tray running,
and the tray says so with a balloon tip rather than only a log line - the same
message covers a key already registered by another application, which was silent
before. The Options form cannot produce either, offering nothing but letters.

KeyRegister parsed the key half of a hot key with Enum.Parse<Keys>, unguarded, and
SettingsValidator only checked that it was non-empty. So "Key": "Ctrl+A" in
settings.json passed the "Cannot start" guard, which only covers reading the file,
and then threw ArgumentException out of ReBindKeys during startup - at every login,
until the file was deleted by hand.

Enum.Parse also reads the underlying number, so "Key": "1" silently bound the left
mouse button rather than the digit.

KeyName.TryParse is the one reader now. It rejects numbers and flag lists before
parsing and accepts aliases, which is why it is not a round trip through ToString:
Keys gives several values two names and prints the other one, so "Enter" would have
been rejected. A key it cannot read leaves that hot key unbound and the tray running,
and the tray says so with a balloon tip rather than only a log line - the same
message covers a key already registered by another application, which was silent
before. The Options form cannot produce either, offering nothing but letters.
@SimonCropp SimonCropp added this to the 20.0.0 milestone Aug 22, 2026
@SimonCropp
SimonCropp merged commit d2c1e46 into main Aug 22, 2026
10 checks passed
@SimonCropp
SimonCropp deleted the fix-hotkey-key-parse branch August 22, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant