I when use gsettings set org.gnome.desktop.background picture-uri file_path from root not working but run from Anotheruser it`s work.
Even when I put it inside crontab -u Anotheruser -e. But not working
My os : ubuntu 16.04 LTS
I tried all the way but it did not.
Example :
su - USER -c "command" # or ways sudo and su crontab -u USER -e DISPLAY=:1 ... DISPLAY=:0 ... DISPLAY=:0.0 ... dbus-launch ... PID=$(pgrep gnome-session) export DBUS_SESSION_BUS_ADDRESS= ... please Help me! thanks
31 Answer
I found the solution :
export DBUS_SESSION_BUS_ADDRESS=$(pgrep -a dbus-daemon -U USERNAME | grep -o 'unix:abstract.*$') gsettings set org.gnome.desktop.background picture-uri FILE_ADDRESS AND into crontab :
@reboot su USERNAME -c 'export DBUS_SESSION_BUS_ADDRESS=$(pgrep -a dbus-daemon -U USERNAME | grep -o "unix:abstract.*$");export DISPLAY=:0;gsettings set org.gnome.desktop.background picture-uri FILE_ADDRESS' just replace USERNAME by your user AND replace FILE_ADDRESS by your picture Address