Tag: GTK

Java and gtk error

Problem: ugly program (no theme applied)
If you get an error like:

/usr/share/themes/Unity/gtk-2.0/gtkrc:41: error: lexical error or unexpected token, expected valid token

when you launch a java program under a GTK enviroment (GNOME) and the program looks really ugly or even it doesn’t start at all you may want to try the following..

Solution: Upgrade to the last 1.6 jdk.

To updgrade to the latest sdk in ubuntu follow this info:

sudo apt-get install sun-java6-jre

and select as the blessed ones:

sudo update-java-alternatives -s java-6-sun

check it:

java -version

If everything is ok launch you program 🙂

P.S.: Check that the program that you’re launching is not using a proper jre (so 1.5) otherwise all your effort will be useless.

Get the accents sorted in GTK and QT at the same time

I was facing a problem that it was really annoying. I’m using english and italian at the same time, and I have a english keyboard from which, getting out some accent is a real pain.


But I I’m not the only one out there to face this problem and so there are several solutions.
I will speak only about one that is working for me.

Enable the xim module:

add to /etc/enviroments


Copy the /usr/share/X11/locale/en_US.UTF-8/Compose to your home

cp /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose

Now you have to choose the Multi_key. It can be anything. Usually I use the left Windows key. To get the keycode, run


and hit the key. You should get an output like:

KeyRelease event, serial 30, synthetic NO, window 0x2200001,
root 0x13b, subw 0x0, time 105265658, (583,365), root:(587,414),
state 0x10, keycode 115 (keysym 0xff20, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

Now create the file ~/.Xmodmap and write there

keycode 115 = Multi_key

Restart your XServer (log out from the Gnome session or Kde session) and (at least in GNOME) you’ve got a question if you want to load it or not. Load it.

Now you can try. Open anything that can accept a characther and try to click (holding them) “Multi_key ` e”. The result should be “”.

Note that this is consinstent for both Qt and GTK so if you use mixed applications (as I do), you can write properly in both.

The only issue is the order that it seems to be mandatory. The combination “Multi_key ` e” is working but not “Multi_key e `” that is really annoying. From a first look the first one is defined in the .XCompose and the latter not. This let me think that maybe I can rewrite and add all this combination to this file, however it seems really strange and there should be somewhere an option to make it working.

If anyone of you know how to fix an hint will be appreciated. Otherwise I will have to write a short perl script to fix it.