feat: enhance ydotool integration for direct typing on Linux; improve error handling and logging in audio processing; update build scripts for better installation guidance

This commit is contained in:
Your Name
2026-06-09 10:14:33 -07:00
parent 52bb65f3a0
commit 2c5a0b70ed
7 changed files with 308 additions and 216 deletions
+6 -6
View File
@@ -6,6 +6,7 @@ import (
"encoding/binary"
"fmt"
"os"
"runtime"
"sync"
"sync/atomic"
@@ -207,16 +208,15 @@ func (r *AudioRecorder) Stop() error {
// callbacks from writing to a closed file.
atomic.StoreInt32(&r.writing, 0)
// Stop the capture device. We keep the device initialized between recordings
// to avoid the expensive re-initialization cycle. ALSA privacy indicators
// will still turn off because we've stopped the stream.
// Stop the capture device.
if r.device != nil {
if err := r.device.Stop(); err != nil {
logger.Error("Failed to stop audio device: %v", err)
}
// Do NOT Uninit the device between recordings. Keeping it alive
// avoids expensive ALSA device re-probe and reduces CPU spikes.
// The device will be fully cleaned up in Cleanup().
if runtime.GOOS == "linux" {
r.device.Uninit()
r.device = nil
}
}
// Finalize WAV file