41 lines
768 B
Go
41 lines
768 B
Go
package main
|
|
|
|
import (
|
|
"errors"
|
|
"log"
|
|
"os/exec"
|
|
)
|
|
|
|
func hyprpaperPreload(path string) error {
|
|
log.Println("path: ", path)
|
|
out, err := exec.Command("hyprctl", "hyprpaper", "preload", path).Output()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return checkHyprctlError(out)
|
|
}
|
|
|
|
func hyprpaperWallpaper(path string) error {
|
|
out, err := exec.Command("hyprctl", "hyprpaper", "wallpaper", ","+path).Output()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return checkHyprctlError(out)
|
|
}
|
|
|
|
func hyprpaperUnloadAll() error {
|
|
out, err := exec.Command("hyprctl", "hyprpaper", "unload", "unused").Output()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return checkHyprctlError(out)
|
|
}
|
|
|
|
func checkHyprctlError(out []byte) error {
|
|
str := string(out)
|
|
if str != "ok\n" {
|
|
return errors.New(str)
|
|
}
|
|
return nil
|
|
}
|