diff --git a/gopaper b/gopaper new file mode 100755 index 0000000..5399caa Binary files /dev/null and b/gopaper differ diff --git a/slideshow.go b/slideshow.go index 894b986..9605353 100644 --- a/slideshow.go +++ b/slideshow.go @@ -3,6 +3,7 @@ package main import ( "fmt" "log" + "os" "time" "github.com/xyproto/wallutils" @@ -10,7 +11,7 @@ import ( func slideshow(ch <-chan string) { dir := <-ch - ticker := time.NewTicker(time.Duration(config.Duration) * time.Second) + ticker := time.NewTicker(time.Duration(config.Duration) * time.Minute) go func() { for { @@ -35,5 +36,20 @@ func setRandomWallpaper(dir string) error { if err != nil { return err } - return wallutils.SetWallpaperCustom(img, "fit", false) + + desktopEnv, bool := os.LookupEnv("DESKTOP_SESSION") + if !bool { + panic("cannot determine desktop environment") + } + var mode string + switch desktopEnv { + case "cinnamon": + mode = "span" + case "hyprland": + mode = "fit" + default: + mode = "" + } + + return wallutils.SetWallpaperCustom(img, mode, false) }