gopaper/slideshow.go

28 lines
406 B
Go
Raw Normal View History

2024-10-28 23:29:20 +00:00
package main
2024-10-29 15:18:21 +00:00
import (
"log"
"time"
)
2024-10-28 23:29:20 +00:00
2024-10-29 15:18:21 +00:00
func slideshow(ch <-chan string) {
dir := <-ch
ticker := time.NewTicker(time.Duration(config.Duration) * time.Minute)
go func() {
for {
img, err := pickRandomImage(dir)
if err != nil {
panic(err)
}
hyprpaperSet(img)
select {
case dir = <-ch:
log.Println("directory set!")
continue
case <-ticker.C:
continue
}
}
}()
2024-10-28 23:29:20 +00:00
}