Pages

Showing posts with label nitrogen. Show all posts
Showing posts with label nitrogen. Show all posts

June 07, 2009

Nitrogen

Nitrogen is a friendly tool you can use to set your screen's background image (i.e., wallpaper). To select a new background image, launch nitrogen from the command line, passing it the directory in which you store your background images:

nitrogen /path/to/background/images

This brings up a GUI from which you can select, stretch, etc. your desired image.

You can restore the most recently set background image with the command:

nitrogen --restore

If you place this command in your session startup scripts, every time you login to your session nitrogen will restore your background image.

The only problem with nitrogen is that its image browser expects to be told the directory to search for images. In other words, it does not have a built-in directory browser. To that end, I wrote the following little script to wraps nitrogen inside a directory selection GUI. Enjoy.
#! /bin/bash

# Mithat Konar 2009-06-07
# Wraps nitrogen inside a directory selection GUI.
# Requires: nitrogen, zenity

ui_browseTitle="Select a directory (Cancel to quit)"

theDirectory=~

while [ "$theDirectory" != "" ]; do
theDirectory=$(zenity --file-selection --title "$ui_browseTitle"  --directory --filename="${theDirectory}/");

if [ "$theDirectory" != "" ]; then
nitrogen --no-recurse "$theDirectory"
fi
done