- Little shell script to change desktop wallpaper, write down this to your crontab
# run the script each 5 minutes
*/5 * * * * ~/bin/chwall.sh
dont forget --> chmod 700 ~/bin/chwall.sh
- Language
- Text only
- Tags
- bash gnome-shell linux shell
chwall.sh
1 #!/bin/bash
2 # http://stackoverflow.com/questions/10374520/gsettings-with-cron
3 # author: Sergio Luiz Araujo Silva
4 # creatad: 2012/09/11
5
6 # crontab -e
7 # */5 * * * *
8
9 # TODO: At night only dark wallpapers.
10
11 # Wallpaper's directory.
12 dir="${HOME}/Imagens/wallpapers/"
13
14 # Weird, but necessary thing to run with cron.
15 sessionfile=`find "${HOME}/.dbus/session-bus/" -type f`
16 export `grep "DBUS_SESSION_BUS_ADDRESS" "${sessionfile}" | sed '/^#/d'`
17
18 # Random wallpaper.
19 wallpaper=`find "${dir}" -type f | shuf -n1`
20
21 # Change wallpaper.
22 # http://bit.ly/HYEU9H
23 #gsettings set org.gnome.desktop.background picture-options "spanned"
24 gsettings set org.gnome.desktop.background picture-options "stretched"
25 gsettings set org.gnome.desktop.background picture-uri "file://${wallpaper}"
Comments
Sign in to leave a comment.

