i3-wallpaper-manager/main.go
Simon Vieille 3e3f4445a4
Some checks are pending
ci/woodpecker/push/build Pipeline is pending approval
ci/woodpecker/push/test Pipeline is pending approval
fix #1: add cache of latest command to not run wallpaper update when it's already up to date
2024-08-11 19:16:00 +02:00

36 lines
539 B
Go

package main
import (
"log"
"os"
"go.i3wm.org/i3"
)
func main() {
recv := i3.Subscribe(i3.WorkspaceEventType)
if len(os.Args) != 2 {
log.Printf("[ERROR] Configuration required!")
os.Exit(1)
}
config, err := LoadConfiguration(os.Args[1])
if err != nil {
log.Printf("[ERROR] %s", err.Error())
os.Exit(1)
}
var lastCommand string
UpdateWallapers(config, &lastCommand)
for recv.Next() {
event := recv.Event().(*i3.WorkspaceEvent)
if event.Change == "focus" {
UpdateWallapers(config, &lastCommand)
}
}
}