0

Im trying to create a script to change the background image on startup. I created a file with this code:

REAL_UID=$(id --real --user)
PID=$(pgrep --euid $REAL_UID gnome-session | head -n 1)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2- | sed -e "s/\x0//g")

gsettings set org.gnome.desktop.background picture-uri-dark file:///Path_to_jpg gsettings set org.gnome.desktop.background picture-uri file:///Path_to_jpg

When i try to run this file with a cron configuration to run every minute like this, i dont have an issue:

*/1 * * * * /home/alejandro/Wallpaper.sh

But when i configure it like this, it doesnt work:

@reboot /home/alejandro/Wallpaper.sh

I added a line with "date >> /file" to check if the script was running and it does write a log.

What is missing for the script to work on startup?

0 Answers0