#!/bin/bash # repertoire de fonds d'ecran export WALLPAPERS="$HOME/wallpapers/" # lxde if [ -n "$(pgrep "^lxsession$")" ] ; then export DISPLAY=:0 pcmanfm -w "`find $WALLPAPERS -name '*.jpg' | shuf -n 1`" || echo "Error settings wallpaper" fi # gnome 2 #gconftool -t str -s /desktop/gnome/background/picture_filename "`find $WALLPAPERS -name '*.jpg' | shuf -n 1`" if [ -n "$(pgrep "mate-session")" ] ; then # variable DBUS necessaire pour fonctionnement gconftool dans un processus lance hors gnome if [ -z $DBUS_SESSION_BUS_ADDRESS ] ; then . $HOME/.dbus/session-bus/`cat /var/lib/dbus/machine-id`-0 export DBUS_SESSION_BUS_ADDRESS fi gsettings set org.mate.background picture-filename "`find $WALLPAPERS -name '*.jpg' | shuf -n 1`" || echo "Error settings wallpaper" fi if [ -n "$(pgrep "gnome-shell")" ] ; then # variable DBUS necessaire pour fonctionnement gconftool dans un processus lance hors gnome if [ -z $DBUS_SESSION_BUS_ADDRESS ] ; then . $HOME/.dbus/session-bus/`cat /var/lib/dbus/machine-id`-0 export DBUS_SESSION_BUS_ADDRESS fi # gnome 3 export GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.background picture-uri "file:`find $WALLPAPERS -name '*.jpg' | shuf -n 1`" || echo "Error settings wallpaper" fi if [ -n "$(pgrep "awesome")" ] ; then # pour que ça marche il faut les variables d'environnement DISPLAY et XAUTHORITY # on les trouve dans l'env de dbus dont le pid est $DBUS_SESSION_BUS_PID export `strings /proc/$DBUS_SESSION_BUS_PID/environ | grep -w 'XAUTHORITY\|DISPLAY'` awsetbg -r $WALLPAPERS fi # xfce if [ -n "$(pgrep "xfce4-session")" ] ; then if [ -z $DBUS_SESSION_BUS_ADDRESS ] ; then export DISPLAY=:0 export $(cat /proc/$(pgrep "xfce4-session")/environ | grep -z "^DBUS_SESSION_BUS_ADDRESS=") fi xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "`find $WALLPAPERS -name '*.jpg' | shuf -n 1`" fi