17

I am running Mint 13 with Cinnamon 1.6. I would like my desktop wallpaper to automatically change depending on the time of day. So, the first thing that comes to mind is setting up a cron job to do it for me. Problem is, I don't know how to change the wallpaper from script / terminal.

What I would like to know:
1) How would one change the background from terminal?
2) Is the there already a built-in way of doing this?

2
  • 1
    What's your DE?
    – daisy
    Commented Dec 28, 2012 at 9:30
  • @warl0ck - Cinnamon 1.6 Commented Dec 28, 2012 at 10:04

6 Answers 6

25

This is the correct answer to the question. Anything else would just be a hack

 gsettings set org.cinnamon.desktop.background picture-uri  "file:///filename"
0
11

With Linux Mint 16 (not sure about other versions) you can use gsettings to both get information about your current wallpaper as well as set it.

The man gsettings is a little thin, but TAB completion will work at most steps in the following commands.

Get info:

gsettings get org.cinnamon.desktop.background picture-uri
gsettings get org.cinnamon.desktop.background picture-opacity
gsettings get org.cinnamon.desktop.background picture-options

To change any option, simply change "get" to "set" and add the new value to the end.

Here is a quick script that will cycle over a known list of wallpapers:

#!/bin/sh
#
# Set the wallpaper from a list
#
# The list, all can be found in $BASE
BASE="file:///home/tigger/.wallpapers/"
LIST="shot1.png another.png just_no_space_in_name.png keep_adding.png"

# The current wallpaper
current=`gsettings get org.cinnamon.desktop.background picture-uri`
opacity=`gsettings get org.cinnamon.desktop.background picture-opacity`
options=`gsettings get org.cinnamon.desktop.background picture-options`

# loop over the list until we find a match
matched=0
new=""
for wp in $LIST
do
    if [ $matched -eq 1 ]
    then
        new="${BASE}${wp}"
        break
    elif [ "'${BASE}${wp}'" = "${current}" ]
    then
        matched=1
    fi
done

# if "$new" is blank, then we show the first shot
if [ "$new" = "" ]
then
    new=${BASE}${LIST%% *}
fi

# set the wallpaper
gsettings set org.cinnamon.desktop.background picture-uri \'${new}\'
gsettings set org.cinnamon.desktop.background picture-opacity ${opacity}
gsettings set org.cinnamon.desktop.background picture-options ${options}
4

In terms of the x window system you want to change the background of the root window. The "builtin"-tool to change the settings of this window is xsetroot. Unfortunately it's a bit outdated, for instance it only supports to choose bitmaps for the background-image.

I prefer the tool hsetroot over xsetroot. Both tools must be used from the command line.

Moreover I can imagine that you can adjust settings of the root window via the x resource database but i can't find related informations by now.

1
  • hsetroot seems to be exactly what I want, but it's not setting my desktop background; instead, it sets the background of the workspaces selection when I hover over the hot corner. Any ideas? Commented Dec 28, 2012 at 11:18
4

Works for me on Linuxmint 13 with Cinnamon 1.4.

  • cinnamon-settings desktop # in terminal > Untick "Let file manager handle the desktop"
  • change your wallpaper with feh
    feh --bg-fill ~/Images/my_wallpaper.png
3

Try this:

xsetbg /path/to/wallpaper.jpg
2
  • Thanks, but it does not affect the wallpaper. It does however change the screen shown when logging out. I'm starting to think that Cinnamon treats x11 settings in a different way than other environments do. Commented Dec 28, 2012 at 19:26
  • @user1166877: Wierd, it works for me. I've used Metacity and Openbox as window managers, but I think this is "below" that. Check out precisely what I use if that could offer a clue as to what differs. Commented Dec 28, 2012 at 22:58
1

There is something called DesktopNova.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .