Script to automatically change background
This commit is contained in:
Raoul Branten 2025-05-19 18:09:28 +02:00
commit b74235d9de

18
changebackground.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# This script is used to change the background of the desktop
#
# Generate a background image using xstarfish
SCREENWIDTH=$(xdpyinfo | awk '/dimensions/{print $2}' | grep -oE ^[[:digit:]]\+)
SCREENHEIGHT=$(xdpyinfo | awk '/dimensions/{print $2}' | grep -oE [[:digit:]]\+$)
SIZE="${SCREENWIDTH}x${SCREENHEIGHT}"
if [ -f /usr/bin/xstarfish ]; then
/usr/bin/xstarfish -g $SIZE -o /tmp/background.jpg
else
echo "ERROR: xstarfish not found"
fi
# Change the background image
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorHDMI-1-0/workspace0/last-image -s /tmp/background.jpg