river: Change to swaybg for stable wallpaper setting

Multi-output wallpaper setting was never particularly stable using swww.

Using swaybg we can directly call on the 'description' of the outputs
like we do in kanshi. This makes the interface way more stable than
hoping that 'DP-3' and or 'DP-5' are discovered first. Thus, we default
to use swaybg and my screens, but if the program is not found on the
system we can still fall back to swww.
This commit is contained in:
Marty Oehme 2025-02-14 10:26:02 +01:00
parent 98dad64976
commit 1ab2b3a94f
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -270,12 +270,18 @@ setxkbmap -option "compose:menu"
[ "$(pidof kanshi)" -eq 0 ] || riverctl spawn kanshi
# set a nice wallpaper
if exist swww; then
riverctl spawn "swww init"
if exist swaybg; then
killall swaybg
riverctl spawn "swaybg \
-o 'LG Electronics W2442 0x000574E1' -i pictures/wall_l.jpg \
-o 'LG Electronics W2442 0x000574FD' -i pictures/wall_r.jpg \
"
elif exist swww; then
riverctl spawn "swww-daemon"
outputs=$(swww query | cut -d':' -f1)
if [ "$(echo "$outputs" | grep -c -e '^DP')" -eq 2 ] && [ -e "$HOME/pictures/wall_r.jpg" ]; then
swww img -o "$(echo "$outputs" | head -n1)" "$HOME/pictures/wall_r.jpg"
swww img -o "$(echo "$outputs" | tail -n1)" "$HOME/pictures/wall_l.jpg"
swww img -o "$(echo "$outputs" | head -n1)" "$HOME/pictures/wall_l.jpg"
swww img -o "$(echo "$outputs" | tail -n1)" "$HOME/pictures/wall_r.jpg"
elif [ -e "$HOME/pictures/wall.jpg" ]; then
swww img "$HOME/pictures/wall.jpg"
fi