// Copyright (c) 2026 Storm Dragon // Authors: Storm Dragon, Angus Kola // SPDX-License-Identifier: GPL-3.0-or-later package app import ( "context" "git.stormux.org/storm/cthulhu/internal/input" ) func runCopyFeedback(ctx context.Context, changes <-chan struct{}, source any, speech speechEnqueuer, live *liveSettings, ocr *ocrSession) <-chan struct{} { done := make(chan struct{}) go func() { defer close(done) var announced uint64 for { select { case <-ctx.Done(): return case _, ok := <-changes: if !ok { return } activity := recentInput(source) if ocr != nil && ocr.Reviewing() { if activity.Clipboard == input.CopyAction { announced = activity.Sequence } continue } if live != nil && live.Load().Reading.AutomaticallyReadClipboardChanges { continue } if activity.Clipboard != input.CopyAction || activity.Sequence == 0 || activity.Sequence == announced { continue } announced = activity.Sequence speech.Enqueue(speechRequest{Text: "copied to clipboard", Role: "system", Cause: "clipboard"}) } } }() return done }