2024-10-26 23:47:38 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
|
|
|
func hyprpaperPreload(path string) error {
|
2024-10-27 16:21:28 +00:00
|
|
|
out, err := exec.Command("hyprctl", "hyprpaper", "preload", path).Output()
|
2024-10-26 23:47:38 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2024-10-27 16:21:28 +00:00
|
|
|
return checkHyprctlError(out)
|
2024-10-26 23:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func hyprpaperWallpaper(path string) error {
|
2024-10-27 16:21:28 +00:00
|
|
|
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", "all").Output()
|
2024-10-26 23:47:38 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2024-10-27 16:21:28 +00:00
|
|
|
return checkHyprctlError(out)
|
|
|
|
}
|
|
|
|
|
|
|
|
func checkHyprctlError(out []byte) error {
|
2024-10-26 23:47:38 +00:00
|
|
|
str := string(out)
|
|
|
|
if str != "ok\n" {
|
|
|
|
return errors.New(str)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|