Getting Themes Working in Revolution
Linux

Unlike Mac OS X and Windows, where Revolution automatically uses the window decorations and control styles of the OS'es theme, in Linux you need to do certain things to make sure that both Revolution itself as well as your standalones use the currently installed window decorations and control styles (for the purposes of this tip, I'll call this the "theme").

How Do I Know If I've Got Theme Support Running Or Not?

Good question. Here's how you can tell... Revolution defaults to using the "Motif" look and feel if it can't find any theme support. Here's some comparison screenshots (taken of RevZilla 2.1 running under Ubuntu) for reference:

Linux Motif

Motif "Look and Feel"

Linux Themed

Full Theme Support

If you are seeing Motif when you should be seeing the currently installed theme, here's what you need to know to get themes going in Linux.

Check Your Install

Applications on Linux (those accessible by everyone) should probably be installed in the /opt directory. However if you didn't know that, or didn't have access rights to install in /opt, you might have installed Revolution in /home/<userName>.

The Revolution download includes a bunch of files, but for this purpose, the only two that matter are these:

The revolution.x86 file is the executable file; launch this and Revolution will launch in all its glory... all its Motif glory that is; no themes will be displayed.

The revolution.sh file is a shell script file; a file that contains a series of commands to run, much like executing each command in succession in the Console window. This is the key file that you need to look at to get themes working in Rev if you don't already have it, and what you need to launch in order to get Revolution to display the proper theme (if the file is configured properly).

Here's an example of the revolution.sh file that came with my Revolution download:

#!/bin/sh

export REV_GDK_PATH=/usr/lib/libgdk-x11-2.0.so.0
export REV_GTK_PATH=/usr/lib/libgtk-x11-2.0.so.0
export REV_SSL_PATH=/usr/lib/libssl.so.0.9.7

# Needed to make symlinks/shortcuts work.
cd "/opt/Revolution-2.6.1"
runrev="./revolution.x86"
"$runrev" $* >& /dev/null
Revolution uses the GTK graphical libraries to draw themed controls in Linux. This first part of the revolution.sh file has the links to the libraries that Rev uses - these files have to exist or else Rev can't use them. However this particular revolution.sh did NOT include a link to "libgobject", which is necessary to get themed controls to work. So the top part of this file needed to have this line as well:
export REV_GOBJECT_PATH=/usr/lib/libgobject-2.0.so.0
So not only do you need the four "export"s, but you also have to have the actual files installed as well. So you need to check /usr/lib to make sure that you have the four items listed (or at least the first three if you don't want SSL support).

While you're checking, keep in mind that the "libgdk", "libgtk", and "libgobject" lines are actually symbolic links (aliases) that point to the real files. Here's what I mean... here's the result of my console session (only relevant lines shown):

kray@ubuntu: cd /usr/lib
kray@ubuntu: ls -l libgtk*
lrwxrwxrwx 1 root root 26 2007-03-25 13:35 libgtk-x11-2.0.so.0 -> libgtk-x11-2.0.so.0.800.20
-rw-r--r-- 1 root root 2950692 2007-01-31 17:20 libgtk-x11-2.0.so.0.800.20
(If for some reason you have a symlink to the right file, but the link is named something different, you'll have to change the "export" accordingly. If you don't have these files at all (which happened to me under Kubuntu), you will need to install them. Check your Package Manager application, which should make it reasonably easy to install the GTK files.)

Launching Revolution

As mentioned earlier, if you launch revolution.x86, bypassing revolution.sh, you will launch Revolution, but without theme support. Instead, you need to launch revolution.sh instead. Doing so, will execute the statements in revolution.sh. The top section will link to the libraries; the bottom section handles the launching:

cd "/opt/Revolution-2.6.1"
runrev="./revolution.x86"
"$runrev" $* >& /dev/null
As you can see, the first line changes directory to /opt/Revolution-2.6.1, and the second and third lines launch Revolution. If you have not installed Revolution in /opt, the cd operation will fail, but that doesn't necessarily mean that the launch won't happen. If you keep the revolution.sh file in the same directory as the revolution.x86 file, it will still launch Revolution, even if Rev is not installed in /opt.

So to launch Revolution with theme support, you will need to launch revolution.sh. Depending on how your distro handles launching .sh files, you may be presented with a dialog box asking if you want to display or run the shell file. Choose "Run", and Revolution should launch and should display the current theme.

(If nothing happens, it means that Linux can't find Revolution at all, or that the paths in the "export" lines are invalid. If Revolution launches, but still displays the Motif style, it means that you don't have the "libgobject" export line.)

Final Thoughts

If you did everything right, you should see Revolution running with theme support. So that means that in order to have your applications display with theme support, you need to create a similar shell script file for your app. It may be that when the next Linux version of Revolution is released that this may no longer be needed, or may be provided in a different way. But until that happens, this is what we need to do...

Posted 4/29/2007 by Ken Ray