diff options
author | Andinus <andinus@nand.sh> | 2020-03-24 17:41:57 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-03-24 17:41:57 +0530 |
commit | 813b37d0cf7e6e371418feac56d40f48176105ba (patch) | |
tree | 2e4efd2224ff84700cbf354ea0ff75775d79a8a0 /pkg/background | |
parent | 532c060fd97c31c28f20f6f823472247edc0c30f (diff) | |
download | cetus-813b37d0cf7e6e371418feac56d40f48176105ba.tar.gz |
Reinitialize project and change module url
Diffstat (limited to 'pkg/background')
-rw-r--r-- | pkg/background/download.go | 34 | ||||
-rw-r--r-- | pkg/background/set_darwin.go | 14 | ||||
-rw-r--r-- | pkg/background/set_unix.go | 30 |
3 files changed, 0 insertions, 78 deletions
diff --git a/pkg/background/download.go b/pkg/background/download.go deleted file mode 100644 index 78ff135..0000000 --- a/pkg/background/download.go +++ /dev/null @@ -1,34 +0,0 @@ -package background - -import ( - "fmt" - "io" - "net/http" - "os" -) - -// Download takes path and url as input and downloads the data to a -// file, returning an error if there is one -func Download(file string, url string) error { - o, err := os.Create(file) - if err != nil { - return err - } - defer o.Close() - - res, err := http.Get(url) - if err != nil { - return err - } - defer res.Body.Close() - - if res.StatusCode != http.StatusOK { - return fmt.Errorf("Unexpected Response: %s", res.Status) - } - - _, err = io.Copy(o, res.Body) - if err != nil { - return err - } - return nil -} diff --git a/pkg/background/set_darwin.go b/pkg/background/set_darwin.go deleted file mode 100644 index 2ead214..0000000 --- a/pkg/background/set_darwin.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build darwin - -package background - -import ( - "os/exec" - "strconv" -) - -// Set calls feh to set the background -func Set(path string) error { - err := exec.Command("osascript", "-e", `tell application "System Events" to tell every desktop to set picture to `+strconv.Quote(path)).Run() - return err -} diff --git a/pkg/background/set_unix.go b/pkg/background/set_unix.go deleted file mode 100644 index cd75ae3..0000000 --- a/pkg/background/set_unix.go +++ /dev/null @@ -1,30 +0,0 @@ -// +build linux netbsd openbsd freebsd dragonfly - -package background - -import ( - "fmt" - "os" - "os/exec" -) - -// Set calls feh to set the background -func Set(path string) error { - var err error - 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 - } -} |