Eclipse on linux using smaller (or larger) fonts in all views

Eclipse on linux uses fonts and sizes defined by the GTK theme fonts. While it is fairly easy to change the editor fonts, it is not possible to do it for the views like the project explorer and the rest of the user interface. I found a brilliant article at the Daniel Ferbers Technical Tavern that explains how to run eclipse in its own theme settings and thus control exactly how it looks. And the trick is very easy to do too. The original article with all the details and other options is this: “Smaller font sizes for Eclipse on Linux“. I posted a summary for my own reference.


Eclipse uses the current gtk theme. If you want to affect how everything looks, you should change the desktop theme font size. This would affect everything else though, but there is a trick: you can start eclipse with its own theme. And even better, you can just create a theme by inheriting an existing one and overriding only what you want. I am going to use Ubuntu Ambiance for my example:

Create a theme file for eclipse, let’s say $HOME/.gtkrc-eclipse

$ cd
$ gedit .gtkrc-eclipse

Then add the following lines:

style "eclipse" {
        font_name = "Ubuntu 9"
class "GtkWidget" style "eclipse"

You can use any font type/size you want. Probably you can control a lot of other things too.

Now you have to launch eclipse telling what is the base theme and adding the specialisation. Assuming that your themes are in /usr/share/themes and you have the Ambiance theme, here is the command to launch it (substitute correct paths)

$ GTK2_RC_FILES=/usr/share/themes/Ambiance/gtk-2.0/gtkrc:\
> $HOME/.gtkrc-eclipse \
> /opt/java/eclipse-3.7/eclipse

To create a launcher, you would use:

env GTK2_RC_FILES=/usr/share/themes/Ambiance/gtk-2.0/gtkrc: $HOME/.gtkrc-eclipse '/opt/java/eclipse-3.7/eclipse'

Big thanks to Daniel Ferbers!

Leave a Reply