diff options
Diffstat (limited to 'pkg/background')
-rw-r--r-- | pkg/background/set.go | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/pkg/background/set.go b/pkg/background/set.go index fa95f6f..2badc48 100644 --- a/pkg/background/set.go +++ b/pkg/background/set.go @@ -1,13 +1,27 @@ package background -import "os/exec" +import ( + "fmt" + "os" + "os/exec" +) // Set calls feh to set the background func Set(path string) error { - feh, err := exec.LookPath("feh") - if err != nil { + switch os.Getenv("XDG_CURRENT_DESKTOP") { + case "GNOME", "Unity", "Pantheon": + path = fmt.Sprintf("%s%s", "file://", path) + err = exec.Command("gsettings", "set org.gnome.desktop.background picture-uri", path).Run() + return err + case "LXDE": + err = exec.Command("pcmanfm", "-w", path).Run() + return err + default: + feh, err := exec.LookPath("feh") + if err != nil { + return err + } + err = exec.Command(feh, "--bg-fill", path).Run() return err } - err = exec.Command(feh, "--bg-fill", path).Run() - return err } |