Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In XFCE 4.10 I can refresh my desktop background with xfdesktop --reload.

I would like to know how I can do the same for as many as possible other desktop environments (Unity, KDE, LXDE, Mate, Cinnamon, GNOME2, GNOME3,...).

share|improve this question

closed as too broad by Braiam, Anthon, slm, Zelda, casey Mar 10 at 0:47

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
GNOME 3: gsettings set org.gnome.desktop.background picture-uri file://${outputFile} –  Serge Stroobandt Feb 23 at 15:39
    
Perhaps this is not possible with all desktop environments. On the xplanetFX homepage, I read: "Seamless wallpaper change in GNOME, KDE < 4.3, XFCE and XFCE4, Fluxbox and feh wallpaper changer (KDE > 4.3 with workaround)". –  Serge Stroobandt Feb 23 at 20:13
    
It seems that Unity and KDE do not require any command at all. Both desktop environments refresh the wallpaper automatically upon change of the wallpaper file. –  Serge Stroobandt Feb 24 at 18:21

2 Answers 2

Here is a code example which detects the desktop the environment and reloads the dynamic wallpaper background explicitly when required by the detected desktop environment.

The code should work with GNOME 3, KDE 4, Unity and XFCE. Tested answers with solutions for other desktop environments are welcomed and will be up-voted.

if [ "$XDG_CURRENT_DESKTOP" = '' ]
then
  DESKTOPENV=$(echo "$XDG_DATA_DIRS" | sed 's/.*\(xfce\|kde\|gnome\).*/\1/')
else
  DESKTOPENV=$XDG_CURRENT_DESKTOP
fi
DESKTOPENV=${DESKTOPENV,,}  # convert to lower case

case $DESKTOPENV in
  'gnome') {
    gsettings set org.gnome.desktop.background picture-uri file:///tmp/wallpaper.png'  # GNOME 3 only
    };;
  'kde') {
    :
    };;
  'unity') {
    :
    };;
  'xfce') {
    xfdesktop --reload
    };;
esac
share|improve this answer

You can set the content of the root window (i.e. the background) independently of the window manager or desktop environment. The traditional utility xsetroot only supports a solid color or a black-and-white image. Many image viewing programs can load a color image in popular bitmap formats to the root window, for example the xsetbg utility from Xloadimage or the display utility from ImageMagick or GraphicsMagick.

xsetbg /path/to/image.png
display -window root /path/to/image.png
gm display -window root /path/to/image.png

This doesn't affect your desktop environment's notion of the wallpaper, so it may decide to display its own content in place of yours from time to time.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.