我寫了一個bash腳本來改變壁紙(對於GNOME3)。在終端仿真器執行cron與gsettings
#!/bin/bash
# Wallpaper's directory.
dir="${HOME}/images/wallpapers/"
# Random wallpaper.
wallpaper=`find "${dir}" -type f | shuf -n1`
# Change wallpaper.
# http://bit.ly/HYEU9H
gsettings set org.gnome.desktop.background picture-options "spanned"
gsettings set org.gnome.desktop.background picture-uri "file://${wallpaper}"
腳本(例如侏儒末端)工程巨大。由cron執行,或ttyX終端收到錯誤期間:
** (process:26717): WARNING **: Command line `dbus-launch --autolaunch=d64a757758b286540cc0858400000603 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (process:26717): WARNING **: Command line `dbus-launch --autolaunch=d64a757758b286540cc0858400000603 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (process:26721): WARNING **: Command line `dbus-launch --autolaunch=d64a757758b286540cc0858400000603 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (process:26721): WARNING **: Command line `dbus-launch --autolaunch=d64a757758b286540cc0858400000603 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
的解決方案都沒有爲我工作。 :(我必須在cron表達式中設置DISPLAY =:0.0之前(http://ubuntuforums.org/showthread.php?t=1023215)Ps我試圖運行一個使用pynotify的python腳本 – Hussain
@ Hussain:我開始提問的時間已經過去了一段時間,我敢打賭下面的答案應該會更好 - 只是讀完整個討論。 –