Team LiB
Previous Section Next Section

Hack 24. Convert CursorXP Themes for Use with Linux

Convert custom cursor themes meant for Windows for use with Linux.

Want even fancier cursor themes than those currently available for Linux? A company called Stardock has created a product called CursorXP for Windows XP. It allows Windows users to choose from hundreds of fancy animated cursor themes. This hack is a script that will convert these cursor themes for use with X11 under Linux.

A huge repository of publicly available cursor themes are designed for use with CursorXP. You can find these themes at http://www.wincustomize.com. The specific URL for the cursor themes is http://www2.wincustomize.com/skins.asp?library=25.

You can download one or more of these themes and then use a Perl script to convert them for use with X11, the engine that powers your desktop. Eric Windisch created the original Perl script, which Nicholas Petreley and James Barron have since modified. This hack uses the version of the script called np-sd2xc.pl, which you can download from the O'Reilly catalog page for this book: http://www.oreilly.com/catalog/linuxdeskhks.

You need to have version 6 or better of ImageMagick installed for the script to work properly. You also need these Perl modules installed:

  • Image::Magick

  • Getopt::Long

  • Config::IniFiles

Once you are sure you have all the prerequisite packages installed, download a cursor theme to convert. For example, download the file Gear.zip. Unzip this file to a work directory so that you can perform the conversion. These commands (substitute the name of the zip file you're using for Gear.zip if you are using a different theme) use the newly created directory geartemp as a work directory:

$ mkdir ~/geartemp
$ cd ~/geartemp
$ unzip Gear.zip

This expands your zip file into another file, which in this case is called Gear.CurXPTheme. Even though this file has the extension .CurXPTheme, it's really just another zip file that you can expand with the following command:

$ unzip Gear.CurXPTheme

Now you're almost ready to run np-sd2xc.pl. The -name command switch defines the name of the cursor theme when you install it. This theme was originally called Gear, but you can use another name if you want. For the sake of frivolity, give this theme a new name, CoolGear, by using this command:

$ np-sd2xc.pl -name CoolGear

The conversion program can add drop shadows to all the cursors when it converts the CursorXP cursor themes. It's a matter of taste, but I think drop shadows give the cursor a very nice 3D appearance. If you want the cursors to have drop shadows, add the -shadow command switch and use this command instead:

$ np-sd2xc.pl -shadow -name CoolGear

Now you can install the theme (this example installs it in your home directory). The following commands both install the theme and set it as the default theme (the -R switch tells the cp copy command to recurse through directories so that you'll copy everything below the CoolGear and default directories to the destination ~/.icons):

$ cp -R CoolGear ~/.icons
$ cp -R default ~/.icons

The second command overwrites whatever index.theme file you have in your ~/.icons/default directory.

Start up your favorite desktop or window manager (or exit and restart the desktop or window manager you're using), and you should see the cursor theme, formerly designed for Windows, running on your Linux X server-based desktop!

Not every CursorXP theme converts well. It's possible for a misbehaving cursor theme to prevent you from starting up your window manager or desktop. If you have this problem, switch to a virtual console by pressing Ctrl-Alt-F1. Log in with your normal username. Edit your ~/.icons/default/index.theme file, and change the Inherits parameter to a theme that works.


    Team LiB
    Previous Section Next Section