feat(wallpaper): use swaybg instead of hyprpaper

This commit is contained in:
Moritz Böhme 2023-06-08 11:38:08 +02:00
parent 4737aec6e2
commit e3a95c6dc2
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
4 changed files with 17 additions and 47 deletions

25
modules/programs/wallpaper/wallpaper.sh Normal file → Executable file
View file

@ -14,20 +14,23 @@ function help() {
}
function randomWallpaper() {
find ~/.config/wallpapers/ -type f,l | shuf -n 1
echo "$WALLPAPERS" | shuf -n 1
}
function setWallpaperX {
feh --bg-fill "$1"
}
function setWallpaperWayland {
swaybg --mode fill -i "$1" 2>/dev/null &
}
function setWallpaper() {
case "${XDG_CURRENT_DESKTOP,,}" in
hyprland)
hyprctl hyprpaper preload "$1" &>/dev/null
hyprctl monitors -j | jq '.[].name' | xargs -I{} -P 0 hyprctl hyprpaper wallpaper '{}',"$1" &>/dev/null
hyprctl hyprpaper unload all &>/dev/null
;;
*)
feh --bg-fill "$1" &>/dev/null
;;
esac
if [[ -z ${WAYLAND_DISPLAY+x} ]]; then
setWallpaperX "$1"
else
setWallpaperWayland "$1"
fi
}
# Parse arguments