Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question has two parts:

  1. How to install an x-cursor-theme in Ubuntu via a bash shell script. The cursor theme is not expected to be in the repositories.

  2. How to actually make the new theme become fully active. There is a bug in Ubuntu where the (GUI selected) x-cursor theme will not be used for Java applications (and other special applications) unless one goes through the additional step of selecting the theme via:

    update-alternatives --config x-cursor-theme

Ideally, would like to script that step too so the process is fully automated.

For example, I would like to install the opaque comix cursor theme via a script. I need these two files to get started:

wget -O /tmp/ComixCursors-0.7.3.tar.bz2 http://www.limitland.de/comixcursors/ComixCursors-0.7.3.tar.bz2
wget -O /tmp/ComixCursors-Opaque-0.7.3.tar.bz2 http://www.limitland.de/comixcursors/ComixCursors-Opaque-0.7.3.tar.bz2

What next?

Note that the installation instructions provided at gnome-look.org are not appropriate for Ubuntu/Mint/Debian. I will paste them below. But I want to do this the proper way for Ubuntu, which, as far as I understand it, would use theme files and symlinks (the details of which I haven't figured out).

Non-Ubuntu System Installation

For system-wide installation you need to copy the cursor- directories to you X11 lib directory. Issue these commands::

$ whereis X11 $ man 3 xcursor $ cd /usr/share/icons $ sudo cp -r ~/.icons/ComixCursors* .

Now this will interfere with the cursor theme in your ~/.icons directory, which will have precedence. You will want to rename the cursors directory and edit the index.theme file inside.

If you want to make this theme the system-wide default, edit the file /etc/sysconfig/windowmanager to read::

X_MOUSE_CURSOR="ComixCursors-White-Regular-Slim" or whatever your (custom) cursors directory is named.

share|improve this question

migrated from stackoverflow.com Jan 30 '12 at 1:01

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 1 down vote accepted

Here's the working solution I finally came up with after a bunch of trial and error and some help from others. There are a few things in this script that might seem unnecessary, but testing has indicated that they are required for a fully working solution. A next step would be to allow the cursor to be selected instead of hard-coding the "opaque red huge" selection. However, that was not a requirement for me at this time.

#!/bin/sh

#2012.02.02 this is the working version for Mint 9 and Ubuntu 10.04. It should work in other versions too.
wget -O /tmp/ComixCursors-0.7.3.tar.bz2 http://www.limitland.de/comixcursors/ComixCursors-0.7.3.tar.bz2
wget -O /tmp/ComixCursors-Opaque-0.7.3.tar.bz2 http://www.limitland.de/comixcursors/ComixCursors-Opaque-0.7.3.tar.bz2
tar -C /usr/share/icons/ -xjvf /tmp/ComixCursors-0.7.3.tar.bz2
tar -C /usr/share/icons/ -xjvf /tmp/ComixCursors-Opaque-0.7.3.tar.bz2
rm /tmp/ComixCursors-0.7.3.tar.bz2
rm /tmp/ComixCursors-Opaque-0.7.3.tar.bz2

cat <<MYEOF > /usr/share/icons/ComixCursors-Opaque-Red-Huge/index.theme
    [Icon Theme]
    Name = Comix Cursor opaque Red Huge Bold
    Comment = The opaque Comix Cursors - Red Huge Bold
    Example = default
    Inherits = ComixCursors-Opaque-Red-Huge
MYEOF

update-alternatives --install /usr/share/icons/default/index.theme x-cursor-theme /usr/share/icons/ComixCursors-Opaque-Red-Huge/index.theme 51
update-alternatives --set x-cursor-theme /usr/share/icons/ComixCursors-Opaque-Red-Huge/index.theme

echo "The ComixCursors-Opaque-Red-Huge theme should be active after you log out and log back in"

exit 0

If you copy and paste this code, please note that the terminator for the here-document cannot be indented. It is indented only for StackOverflow formatting purposes.

share|improve this answer

The files you downloaded are not the actual cursors but the cursor sources, you have to build the cursors first. Do this by unpacking the sources, cd into that directory and basically issue the following commands:

$ ./bin/build-cursors
$ make
$ make install

There are various other options, consult the file INSTALL. Now you have build your cursor theme ~/.icons/ComixCursors.custom. Cursor themes are supposed to be a subdirectory of either ~/.icons (per-user insatallation) or /usr/share/icons (system installation). Yo can also move it anywhere an link it to ~/.icons or /usr/share /icons as well.

Other themes don't need to be build, and come as a directory with a directory "cursors" within (the actual X11 cursors and symlinks) and an index.theme file.

Include that build process or use/link pre-build cursors in your script.

share|improve this answer
    
"The files you downloaded are not the actual cursors but the cursor sources" -- no, that's not correct. The files are the actual cursors and they do not require running make. I'll provide the full solution I finally came up with. –  MountainX Feb 9 '12 at 15:48

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.