background/changebackground.sh
Raoul Branten b74235d9de init
Script to automatically change background
2025-05-19 18:09:28 +02:00

19 lines
599 B
Bash
Executable File

#!/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