Changing the mouse cursor in X (xfce) with update-alternatives

The way I got the mouse cursor changed to how I want it in what I believe is a non-fragile way that works in xfce.

So I've been using xfce for a while and I like it, but I wanted a different look for my mouse cursor, so on xfce-look I found ComixCursors (CC), which I thought looked nice. Added bonus, they're already packaged and available in the regular Debian apt-get. Only problem is I don't have a nice, easy way to change the mouse look like on gnome or kde. The easiest I had found was this tip on changing the mouse cursor, but that proved to be not very robust, because when I upgraded xfce earlier tonight I was back to the ugly old cursor. Well, after some frustration, I figured out by looking at the README for crystalcursors (cc) that I should be using update-alternatives. cc is more nicely packaged than CC, though. Whereas CC just plops a bunch of mouse icons in /usr/lib/X11/icons/, cc updates the alternatives for you, and provides the proper .theme files in /usr/share/crystalcursors/, which look something like:

[Icon Theme]
Inherits = crystalwhite

So in order to make CC work I created /etc/X11/cursors/ComixCursors-White-Regular.theme and filled it with

[Icon Theme]
Inherits = ComixCursors-White-Regular

I could have done this for all of the CC cursors, but I decided that white regular is my favorite, so why bother with the rest. Then I looked at the present alternatives for x-cursor-theme by entering

# update-alternatives --display x-cursor-theme

which spit the following back at me:

x-cursor-theme - status is auto.
 link currently points to /etc/X11/cursors/core.theme
/etc/X11/cursors/core.theme - priority 30
/etc/X11/cursors/redglass.theme - priority 20
/etc/X11/cursors/whiteglass.theme - priority 20
/etc/X11/cursors/handhelds.theme - priority 20

I decided to go ahead and give the white CC the same priority as the other non-core themes, so I updated update-alternatives with

# update-alternatives --install /etc/alternatives/x-cursor-theme \
x-cursor-theme /etc/X11/cursors/ComixCursors-White-Regular.theme 20

then I ran

# update-alternatives --config x-cursor-theme

and chose the number next to /etc/X11/cursors/ComixCursors-White-Regular.theme, and things still didn't work, but that was because the index.theme in /usr/lib/X11/icons/default/ had disappeared in the midst of my tinkering, so I had to link it back to the x-cursor-theme with

# ln -s /etc/alternatives/x-cursor-theme \
/usr/lib/X11/icons/default/index.theme

and after that, success! The moral of the story is that update-alternatives is a bit confusing at first. I learned to follow the usage message it spits out at you instead of the man page, because they conflict slightly. Once you get the hang of it, however, it's a fun and powerful tool.

One last note is that, as cool as update-alternatives is, xfce should really have an easy, gui way to change the mouse cursor. Sounds like a good project.

Update 2006-04-17: This solution isn't robust either, I guess, because a recent upgrade has borked it back to the ugly old core cursors. I think it has something to do with the last X.Org upgrade. More to come as I figure it out.

Update 2006-04-20: Something about that upgrade, and xserver-xorg, and how it removed xserver-common, messed a bunch of stuff up. I think it might have something to do with this bug report on the package. Anyway, after some freaking out on my part and installing and uninstalling stuff in aptitude, the ComixCursors are back. Yay. I think after the next clean-slate reinstall I'm going to go back to testing. Unstable is too stressful.

Update 2006-06-17: On a recent upgrade, the ComixCursors package installed all of the various ComixCursors .theme files in /etc/X11/cursors/. Sweet. The package maintainer must've received the brain signals I transmitted.

keywords: tech, X, X11, mouse cursors, xfce, xfce4, Debian, linux, update-alternatives created 2006-03-22 last modified 2010-09-13