
Wenn ich es gsettings set org.gnome.desktop.background picture-uri file_path
als Root verwende, funktioniert es nicht, aber wenn ich es als Anotheruser ausführe, funktioniert es.
Auch wenn ich es in crontab -u Anotheruser -e einfüge. Aber es funktioniert nicht
Mein Betriebssystem: Ubuntu 16.04 LTS
Ich habe alles versucht, aber es hat nicht geklappt.
Beispiel :
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= ...
bitte helft mir! Danke
Antwort1
Ich habe die Lösung gefunden:
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
UND in 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'
Ersetzen Sie es einfach USERNAME
durch Ihren Benutzer UND FILE_ADDRESS
durch Ihre Bildadresse.