Allow keyboard interruption of i3 speech during terminal handoff

This commit is contained in:
ak47 committed 2026-11-07 15:16:26 -05:00
1 parent a29910d002
commit e7d02b1f62
9 files changed
+205 -8

No files matched your search

+17
View File
@@ -60,6 +60,7 @@ func (worker *speechWorker) interruptLocked() {
if worker.beepCancel != nil {
worker.beepCancel()
}
worker.handoffSpeech = false
worker.titleInput.protectRepeats = false
worker.titleWindow = atspi.ObjectID{}
if worker.readAllCancel != nil {
@@ -102,6 +103,22 @@ func (worker *speechWorker) BeginReadAll(ctx context.Context, timestamp uint32)
func (worker *speechWorker) InterruptForInput(event input.Event) bool {
worker.mutex.Lock()
defer worker.mutex.Unlock()
return worker.interrupt_for_input_locked(event)
}
// Terminal keystrokes normally belong entirely to its delegated reader. Only
// explicitly admitted local desktop speech opens this cancellation path; the
// backend still cancels Cthulhu's own clients, never the terminal reader's.
func (worker *speechWorker) InterruptForHandoffInput(event input.Event) bool {
worker.mutex.Lock()
defer worker.mutex.Unlock()
if !worker.handoffSpeech {
return false
}
return worker.interrupt_for_input_locked(event)
}
func (worker *speechWorker) interrupt_for_input_locked(event input.Event) bool {
if event.Timestamp != 0 && worker.commandTimestamp != 0 && int32(event.Timestamp-worker.commandTimestamp) <= 0 {
return false
}