#!/bin/bash # This script is run by Variety when a new wallpaper is set. # The first passed parameter (accessed with $1) is the absolute path to the wallpaper. # The second passed parameter ($2) is "auto" when the wallpaper is changed automatically (i.e. regular change) # and "manual" otherwise - e.g. when the user clicks Previous, Next or Trash. # You can use bash, python or whatever suits you for the script. # Here you can put custom commands for setting the wallpaper on your specifc desktop environment # or run commands like notify-send to notify you of the change, or you can # run commands that would theme your browser, login screen or whatever you desire. # KDE - User will have to manually choose ~/.config/variety/wallpaper-kde.jpg as a wallpaper. # Afterwards, with the command below, Variety will just overwrite the file when changing the wallpaper # and KDE will refresh it if [ "`env | grep KDE_FULL_SESSION | tail -c +18`" == "true" ]; then cp "$1" ~/.config/variety/wallpaper-kde.jpg exit 0 fi # Gnome 3, Unity cp "$1" $HOME/Pictures/variety-wallpaper.jpg gsettings set org.gnome.desktop.background picture-uri "file://$HOME/Pictures/variety-wallpaper.jpg" 2> /dev/null if [ "`gsettings get org.gnome.desktop.background picture-options`" == "'none'" ]; then gsettings set org.gnome.desktop.background picture-options 'zoom' fi # XFCE xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "" 2> /dev/null xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "$1" 2> /dev/null # LXDE/PCmanFM pcmanfm --set-wallpaper "$1" 2> /dev/null # Feh - commented, as it may cause problems with Nautilus, (see bug https://bugs.launchpad.net/variety/+bug/1047083) # feh --bg-scale "$1" 2> /dev/null # Mate mateconftool-2 -t string -s /desktop/mate/background/picture_filename "$1" 2> /dev/null # Gnome 2 gconftool-2 -t string -s /desktop/gnome/background/picture_filename "$1" 2> /dev/null # Show a notification on wallpaper change (only when the change is automatic) # name=$(echo "$1" | sed 's/\//\n/g'| tail -n 1) # if [ "$2" == "auto" ]; then notify-send --icon "$1" "Wallpaper changed" "$name" ; fi