fix(keybinding): release held shortcuts and modifiers when the screen locks or the PC sleeps

The lock desktop swallows keyup, so a hold-to-talk recording never ended,
the first shortcut after unlocking was dropped as auto-repeat, and Win from
Win+L made the next suggestion accept wait out the full 1.5s modifier timeout.
On powerMonitor lock-screen/suspend the chord machine now emits released for
emitted triggers and clears its state, and modifier tracking forgets held keys.
This commit is contained in:
Yun Chan 2026-10-21 00:28:40 +09:00
parent 8d003c8fca
commit 3e6cfd1ba8
6 changed files with 94 additions and 2 deletions

View file

@ -276,6 +276,22 @@ export class ChordStateMachine {
this._active.clear()
}
/**
* 떼는 이벤트가 오지 않을 순간(화면 잠금·절전)에 부른다. 이미 보낸 pressed 에는 released 를 보내
* hold 녹음이 끝나게 하고, 보류 중인 트리거는 버린다. 그 뒤 reset 처럼 모두 비운다.
* 안 비우면 잠금을 푼 뒤 첫 누름이 auto-repeat 로 버려진다.
*/
releaseAll(): void {
for (const trigger of this._pending) {
trigger.cancelTimer?.()
trigger.cancelTimer = null
trigger.status = 'cancelled'
}
this._pending.clear()
for (const key of [...this._isDown]) this._release(key)
this.reset()
}
// ── 입력 ───────────────────────────────────────────────
/**