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.

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?

share|improve this question
1  
What's your DE? –  warl0ck Dec 28 '12 at 9:30
    
@warl0ck - Cinnamon 1.6 –  aggregate1166877 Dec 28 '12 at 10:04
add comment

6 Answers 6

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.

share|improve this answer
    
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? –  aggregate1166877 Dec 28 '12 at 11:18
add comment

There is something called DesktopNova.

share|improve this answer
add comment

Try this:

xsetbg /path/to/wallpaper.jpg
share|improve this answer
    
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. –  aggregate1166877 Dec 28 '12 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. –  Emanuel Berg Dec 28 '12 at 22:58
add comment

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
share|improve this answer
add comment

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}
share|improve this answer
add comment

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"
share|improve this answer
1  
Without any explanation, this is next to useless. –  vonbrand Mar 12 at 1:28
    
It is the correct answer to the query. Why do you need an explanation? It is the correct way to change the wallpaper on the Cinnamon desktop. –  Ramblin Man Mar 12 at 10:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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