Desktop backgrounds in window managers

December 5, 2007

There are several ways to set the wallpaper when you use a window manager, like Openbox, without a desktop environment. Some window managers, like Fluxbox and Icewm, can set a desktop background (with fbsetbg and icewmbg respectively); Openbox doesn’t deal with the desktop, so you’ll have to use a separate application to accomplish this. The following might still be useful for Fluxbox and Icewm users, as some of the applications discussed below do more than simply display an image on the desktop.

The most popular ways to set a desktop wallpaper in Openbox is by using either Feh or Nitrogen (see my Openbox guide), but there are many other possibilities. I will discuss a few here. If you know of any others, please let me know.

Below I only mention the options and configurations I found useful and/or interesting. Most of the applications have a lot more options than those listed below. As always, I recommend reading the man pages (type “man name of the application” in a terminal) for each app to see what it all can do.

All of the applications discussed here are in the Ubuntu repositories (from Dapper onwards).Many of them are quite old, but they still do the job.

I generally use Feh (both as an image viewer and to set the wallpaper), though I am also fond of Habak and Hsetroot. Use whatever you like best.

Xli

Xli is an “X image loading utility”. Like Feh, Xli is basically an image viewer, that can optionally display an image on the desktop.

To use xli as an image viewer, use the following command:

	xli /path/to/image

When viewing an image with xli, you can rotate the image clockwise (press 'r') or counter-clockwise (press 'l') or change the brightness (press 0-9).

To set the desktop wallpaper with xli, use the following command:

	xli -onroot -fullscreen /path/to/image

Other options are -fillscreen (to fill the entire screen; the image will be zoomed if smaller than the screen) and -fit (makes the image fit to the screen; if the image is smaller it is tiled to fit the screen). If the image is smaller than the screen, xli will draw a border around the image; you can set the colour of the border with -border COLOUR. You can draw the image in greyscale (using -gray), brighten it (using -brighten percentage), or zoom in (using -zoom percentage).

(When I installed xli through aptitude in Dapper it installed the binary in /usr/X11R6/bin/. The command "xli" is therefore not recognised and should be replaced by /usr/X11R6/bin/xli.)

Xloadimage and Xsetbg

Xloadimage is also an image viewer for X. Xloadimage and its component xsetbg accomplish the same tasks as xli, and the very same commands that xli uses are used in xloadimage (just replace xli with xloadimage in the commands given above).

Esetroot

Esetroot is a simple, no-nonsense application to set the background. It belongs with Eterm, but can easily be used independently. Here are the basic commands (note that the proper command is Esetroot, not esetroot):

    To scale an image:

	Esetroot -s /path/to/image

    To centre an image:

	Esetroot -c /path/to/image

    To display an image in its original size:

	Esetroot /path/to/image

Gsetroot

Gsetroot is a graphical (Gtk) front-end for esetroot. Its interface is fairly simple and straightforward: select the image you like to set as a wallpaper, select whether you want it centred, full size, or tiled. It has a 'preview' button, but I am not sure what it does, as it never worked on my computer. Here is what it looks like:

gsetroot

Hsetroot

Hsetroot does a lot more than just displaying an image or a colour on the desktop. As the website tells you, hsetroot "is a tool which allows you to compose wallpapers." Not only can it set solid colours, gradients or image files (centred, tiles, at full size or scaled), but it allows you to manipulate the images you want it to display as well. Thus you can tint an image, blur or sharpen it, adjust the brightness, contrast or gamma-level, flip the image (horizontally, vertically, or diagonally).

Here are some example:

	hsetroot -fill ~/Images/Desktops/bwwoodwall.jpg

This gives me the following desktop image:

hsetroot2

If you would like to tint the image, so that it better matches the theme of your choice, this is the format you use:

	hsetroot -fill ~/Images/Desktops/bwwoodwall.jpg -tint '#B4A783'

This gives me the following desktop image:

hsetroot1

Hsetroot does all this without altering the image file it uses, though you can ask it to save a copy of the image it creates.

Habak

Habak is a versatile tool to set the desktop wallpaper and is part of the T2 Linux distribution (or, according to the developers, the T2 "System Development Environment"). It is a very useful application if you like to stack images on the desktop (with or without transparency), though it does a few more things than that.

Like most applications discussed here, you can set a single image on the desktop (with "habak -hi /path/to/image/file), but you can also set a random wallpaper whenever the program is run. To do so, you have to direct habak to a directory of images (rather than a single image), for example: habak -hi ~/Images/Desktops/. Smaller images are automatically centred, images larger than your screen are automatically scaled. Neat.

You can set more than images with Habak. You can set a single line of text using the command habak -ht "put your text here". The text can be a command, such as the date (`date +%Y-%m-%d`). You can also fade out every other line of your desktop image (some sort of interlace) with the following commands: habak -hI int or habak -hI INT. The first fades out every even line, the second every uneven line; use both of them (habak -hI int -hI INT) to fade out the entire image.

These are the basics of habak, and in "Habak speak" these three tools (-hi for images, -ht for text, and -hI for interlace) are called 'habaks'. You can play with these habaks, and combine any number of them: you can set multiple images, with multiple lines of text and interlace. But to make things more interesting you can also use parameters to modify these habaks. Here are the modifiers:

    -mC: this centres the habak, and is used by default.
    -mp X,Y: this places the habak at the coordinates given for X and Y.
    -mS: this scales the habak, but respects the original proportions.
    -ms: this scales the habak, but disregards the original proportions.
    -mc: this modifies the colour of the habak. The colour string that should follow it is of the structure R,G,B,A -- red, green, blue, and alpha (use something like gcolor2 to find out what the values are for your favourite colour). Thus -mc 0,0,0,255 gives black with no transparency. If unspecified, Habak uses the default semi-transparent light grey.
    -mf: this specifies the .ttf font to be used (you have to specify the entire path to the font file; make sure you specify the name of the font file, rather than the font name). If unspecified, a random font from ~/.fonts is used.
    -mh: this sets the font size (in pixels). The default is 30 pixels.

Place the modifier(s) before the habak you want to modify. The options are applied in the order that the options are listed in the command: if an image comes after a text string, it will cover the text.

As you may have realised by now, the above habaks and modifiers can accomplish a lot. Unfortunately, you can't use Habak to display the time (as it doesn't refresh automatically). If it could, I would use it to replace conky, which I only use to display the date and time anyway. (Xcompmgr doesn't interfere with Habak.)

CWallpaper

Cwallpaper is a front-end for applications that set wallpapers. The website boldly declares that "it has the ability to work with any root wallpaper changer". I have used it succesfully with feh, fbsetbg, Esetroot, hsetroot, xli, and xsetbg. As a front-end for other wallpaper setters, Cwallpaper is useful for those users who like to use command line applications but also like at times a graphical user interface. If you generally use Feh for setting the wallpaper, for example, whatever wallpaper you set with CWallpaper will also be reloaded when you restart Openbox (with "eval `cat $HOME/.fehbg` &" in your autostart file, off course).

Here is what CWallpaper looks like:

cwallpaper

Before you first run CWallpaper, you will have to configure it. You will find an example configuration file in /usr/share/cwallpaper (or /usr/local/share/cwallpaper). Copy that file to ~/.config/cwallpaper/ (create it if it doesn't exist), and edit it to your liking. Specify whatever program you want to use (default is fbsetbg) and the commands it uses to scale, tile, and center the wallpaper ("--bg-scale", "--bg-tile" and "--bg-center" for Feh, etc.).

Next, you will need to specify all the wallpapers you want CWallpaper to display in its window. These are set in the file ~/.config/cwallpaper/wallpapers by entering the full path to the image (including the image name!). This is rather a lot of work if you have a lot of wallpapers, but luckily CWallpaper comes with a handy script to accomplish this task nearly effortlessly. In /usr/share/cwallpaper you will find a script makelist.sh. Copy this anywhere in your home directory (I keep it in the ~/.config/cwallpaper/ directory). Open the file with your favourite text editor and change all the "$1" with the path to your desktop wallpapers directory. Make the script executable (chmod a+x /path/to/script) and run it. It will automatically generate a wallpapers file in the ~/.config/cwallpaper/. (Note that the script also scans for image files in the subdirectories of the directory specified.) Now run cwallpaper and you will be able to set the wallpaper of your choice.

Chbg

Do you like rotating wallpapers? Then chbg might be the application you were looking for. Chbg is a versatile application: its basic function is to change or rotate wallpaper images, but it can also act as screensaver (on its own or as a xscreensaver client), and a slide show application (in its own window). You can adjust the speed, the order in which the images are shown, the position of the images on your desktop or screen, the effects used when changing the image, and a lot more. (Have a look at the screenshots to see what it all can do)

Chbg has a graphical interface for basic configuration (chbg -setup). I have only used the older Gtk1.2 version though it has more recently been ported to Gtk+-2.0. Here is an image of the older configuration window:

chbg_setup

Xscreensaver

What about an animated wallpaper? If you have xscreensaver installed, you can force it to run on the root window (i.e. the desktop). For guidelines how to do this, have a look at K.Mandla's post (also here).

Telak

Telak is able to draw local or remote pictures on your desktop. It doesn't draw the desktop itself (unless you specify that in the configuration file), but shows the image(s) above the desktop wallpaper. You can show multiple images at once, and have a different configuration for each image. You can invert the colours of the image, set the size of the image, the position on the desktop, and the refresh rate. Here is a sample entry in the configuration file (stored in ~/.telak/telakrc):

	[rabbit]
	url = http://www.petcaretips.net/Rabbit6.gif
	width = 40
	height = 40
	x = 10
	y = 10
	refresh = 600

Telak is especially useful if you want your desktop to display changing graphs, or even webcam images.

Xstarfish

If you like things psychedelic, xstarfish is your application! It is "an X wallpaper generator. XStarfish generates colourful, tiled images for your background using random numbers fed through mathematical functions. It does not use source image files, so it can generate its images nearly forever without running out of material." Fun (and headaches) guaranteed!

Just run "xstarfish" and it will generate and display a lovely wallpaper. If want it to generate a new wallpaper every x minutes, seconds, or days, use the following command: "xstarfish -d INTERVAL", where interval is the time you want xstarfish to sleep before creating a new wallpaper (seconds are the default). Be aware that it can take a while to generate a new image.

Here are a few sample screenshots:

xstarfish1 xstarfish2
About these ads

8 Responses to “Desktop backgrounds in window managers”

  1. Can I self-plug and put Nitrogen on this list? (projects.l3ib.org/nitrogen)

    thx!

  2. oh, nevermind, i’m an idiot, i did not see it under a big header therefore i did not think you knew about it :)

  3. Hello, I’m the author of CWallpaper.
    Thank you for mentioning my program :D
    Just in case you’re interested, the latest version of CWallpaper has an option for loading the last wallpaper set. This means that you can use “cwallpaper -l &” as opposed to “eval `cat $HOME/.fehbg` &”.

    If you have any problems or requests for CWallpaper, could you please send me a email, so I can improve it.

    Colin Jones

  4. Peter said

    Re: Chbg
    It is probably worth mentioning that chgb2 is required if you also want to use xcompmgr.

  5. Thiago said

    What about ImageMagick?

    $ display -dispose Background -window root /path/to/image.png

    I don’t know how set a wallpaper to use full window. If anyone do, please tell me :)

    Cheers.

  6. Sam said

    I don’t understand why you didn’t mention feh! It’s so simple for what I need, plus it doubles as an image viewer!

    set a centered bg (what I normally do): feh –bg-center image.png

    set a scaled bg (for higher-res than screen wallpapers): feh –bg-scale image.png

    Then, in .xinitrc:
    eval `cat .fehbg`

    Works like a charm!

  7. urukrama said

    Sam, I covered Feh (and Nitrogen) quite extensively in the Openbox guide, as mentioned in the beginning of this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 79 other followers