diff --git a/main.go b/main.go index 3ececa2..7447769 100644 --- a/main.go +++ b/main.go @@ -159,6 +159,7 @@ func loadFile(path string) (s beep.StreamSeekCloser, format beep.Format, err err func main() { var weatherTime = flag.Duration("weather", -1, "Speak weather?") var noshuffle = flag.Bool("noshuffle", false, "Don't shuffle music order") + var ignoreidle = flag.Bool("ignoreidle", false, "Don't stop the reveil on idle detection change") var sr = flag.Int("samplerate", 44100, "Samplerate for unifying output stream") var claironTime = flag.Duration("clairon", -1, "Time before running the wake up clairon song") flag.DurationVar(&MaxRunTime, "maxruntime", MaxRunTime, "Maximum duration before auto exit") @@ -278,8 +279,12 @@ loop: volume.Volume = -2 - math.Log(5/float64(ntick))/3 } - if xPrintIdle() < idle { - break loop + if ignoreidle == nil || !*ignoreidle { + if idle < 60000 { + idle = xPrintIdle() + } else if xPrintIdle() < idle { + break loop + } } case <-interrupt: break loop