Able to ignore low idle time (in case I'm not alone and write on my computer)

This commit is contained in:
nemunaire 2021-01-29 01:35:05 +01:00
parent 0057ca3479
commit 32fb349db7

View File

@ -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