feat(hotkeys): persistent conflict marker in Settings

A toast is gone by the time the user opens Settings, so a hotkey Windows
refused looked perfectly configured while doing nothing. The offending row now
carries a ⚠ marker (amber border + tooltip explaining the combo is taken)
until a re-registration clears it.

Delphi reports slot ids instead of labels; HOTKEY_SLOTS maps id → button +
label in one place, so JS owns the wording and can flag the exact row. The
markers are re-applied by openSettings, surviving panel re-renders.

Also stop toasting success on the startup push (it fires on every unlock) —
autofillPushHotkeys(true). A clash still warns: that one is actionable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-25 17:52:05 +01:00
parent 3d3ab3b02b
commit 4965ff2518
4 changed files with 73 additions and 19 deletions
+8 -9
View File
@@ -863,10 +863,9 @@ begin
// we register both with the supplied combos (replacing any prior).
else if ACmd = 'autofill/hotkeys' then
begin
// Names of the combos Windows refused (already held by another app), so
// the toast can say WHICH one is dead instead of leaving the user to
// wonder why a hotkey silently does nothing. A combo the user cleared
// (vk=0) is skipped on purpose and never listed here.
// Slot ids of the combos Windows refused (already held by another app).
// Ids, not labels: JS owns the wording AND uses them to flag the exact
// row in Settings. A combo the user cleared (vk=0) is never listed.
var LFailed := '';
// Quick-search combo is set unconditionally (independent of the
// autofill enabled flag) so the picker stays armed even when the
@@ -876,7 +875,7 @@ begin
var LQsMods := Word(StrToIntDef(GetParam('qs_mods'), 6));
var LQsVk := Word(StrToIntDef(GetParam('qs_vk'), Ord('Q')));
var LQsOk := FBridge.SetQuickSearchHotkey(LQsMods, LQsVk);
if (not LQsOk) and (LQsVk <> 0) then LFailed := LFailed + 'Quick search, ';
if (not LQsOk) and (LQsVk <> 0) then LFailed := LFailed + 'quickSearch,';
LogLine(Format('Quick-search hotkey set — mods:%d vk:%d (ok=%s)',
[LQsMods, LQsVk, BoolToStr(LQsOk, True)]));
end;
@@ -887,7 +886,7 @@ begin
var LNeMods := Word(StrToIntDef(GetParam('ne_mods'), 6));
var LNeVk := Word(StrToIntDef(GetParam('ne_vk'), Ord('A')));
var LNeOk := FBridge.SetNewEntryHotkey(LNeMods, LNeVk);
if (not LNeOk) and (LNeVk <> 0) then LFailed := LFailed + 'New entry, ';
if (not LNeOk) and (LNeVk <> 0) then LFailed := LFailed + 'newEntry,';
LogLine(Format('New-entry hotkey set — mods:%d vk:%d (ok=%s)',
[LNeMods, LNeVk, BoolToStr(LNeOk, True)]));
end;
@@ -911,11 +910,11 @@ begin
LogLine(Format('Autofill hotkeys set — full=mods:%d vk:%d pwd=mods:%d vk:%d totp=mods:%d vk:%d (all_ok=%s)',
[LFullMods, LFullVk, LPwdMods, LPwdVk, LTotpMods, LTotpVk, BoolToStr(LAllOk, True)]));
if (not FBridge.AutofillFullActive) and (LFullVk <> 0) then
LFailed := LFailed + 'Autofill (full), ';
LFailed := LFailed + 'full,';
if (not FBridge.AutofillPwdActive) and (LPwdVk <> 0) then
LFailed := LFailed + 'Password only, ';
LFailed := LFailed + 'password,';
if (not FBridge.AutofillTotpActive) and (LTotpVk <> 0) then
LFailed := LFailed + '2FA code, ';
LFailed := LFailed + 'totp,';
end;
// One notification for the whole batch, naming the combos that failed —
// empty string = everything registered.