From 305f1609c5b1703ea4aaf79347eb7bed14e676d2 Mon Sep 17 00:00:00 2001 From: Daniel Tsvetkov Date: Sat, 7 Sep 2024 16:06:59 +0200 Subject: [PATCH] auto iterate monitors --- apod.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apod.sh b/apod.sh index e282049..b61c416 100755 --- a/apod.sh +++ b/apod.sh @@ -4,10 +4,11 @@ set -x env -export DISPLAY=:1 +export DISPLAY=:0.0 export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus" -WALLPAPERS_DIR=/usr/local/google/home/pisquared/Pictures/wallpapers +WALLPAPERS_DIR=/home/pi2/Pictures/wallpapers +mkdir -p $WALLPAPERS_DIR NASA_APOD_BASE_URL="https://apod.nasa.gov/apod" IMAGE_URL=`curl -s $NASA_APOD_BASE_URL/astropix.html | grep -oh 'href="image/.*"' | grep -oh 'image/.*jpg' | head -1` if [ "$1" == "r" ] || [ -z "$IMAGE_URL" ]; then @@ -21,7 +22,7 @@ fi # OPTIONS DEPENDING ON ENV # - for cinnamon -gsettings set org.cinnamon.desktop.background picture-uri "file://$WALLPAPERS_DIR/$IMG" +#gsettings set org.cinnamon.desktop.background picture-uri "file://$WALLPAPERS_DIR/$IMG" # - for gnome #gsettings set org.gnome.desktop.background picture-uri "file://$WALLPAPERS_DIR/$IMG" @@ -30,5 +31,6 @@ gsettings set org.cinnamon.desktop.background picture-uri "file://$WALLPAPERS_DI # feh --bg-fill "$(pwd)/image.jpg" # - for XFCE (modify the displays names, e.g. to view them - run xrandr) -# xfconf-query --channel xfce4-desktop --property /backdrop/screen0/monitoreDP-1/workspace0/last-image --set "$WALLPAPERS_DIR/$IMG" -# xfconf-query --channel xfce4-desktop --property /backdrop/screen0/monitorHDMI-2/workspace0/last-image --set "$WALLPAPERS_DIR/$IMG" +for MONITOR in $(xrandr --listmonitors | tail +2 | cut -d' ' -f6); do + xfconf-query --channel xfce4-desktop --property "/backdrop/screen0/monitor${MONITOR}/workspace0/last-image" --set "$WALLPAPERS_DIR/$IMG" +done