make it work on cinnamon
This commit is contained in:
parent
c46ab056f5
commit
9b4acc1dca
20
slideshow.go
20
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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue