Sunday, July 24, 2011

[Hint] Smaller font sizes for Eclipse on Linux


The idea of this hint is not to reduce the size of the editor font, but the size of the font in the menus in Eclipse. Great for a smaller screen.



Overwriting the GTKtheme


Although it is theoretically possible to create a new GTK theme from scratch just to launch eclipse, this would require an extraneous amount of work. Or you can create a modified copy of your preferred theme, but this would not easily portable to other machines or to newer versions of GTK. It is much easier to use an existing theme, just overwriting some parameters (the font and size).


Somewhere on your home directory, create a gtkrc file (like: ~/.gtkrc-eclipse) with following content:











style "eclipse" {









        font_name = "Sans Condensed 8"









}









class "GtkWidget" style "eclipse"




Finally, to launch eclipse, use following command line:











GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:/home/user/.gtkrc-eclipse '/opt/eclipse-3.3/eclipse'




(note: the command above shall be written as one line)


or, for a desktop icon:











env GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:/home/user/.gtkrc-eclipse '/opt/eclipse-3.3/eclipse'




(note: the command above shall be written as one line)


Note that GTK loads the gtkrc files in the order that they appear in the GTK2_RC_FILES variable. Files to the right may overwrite configuration from files to the left. In this case, the .gtkrc-eclipse file overwrite the font settings for elements based on GtkWidget (that means, all GTK widgets).


Pros:



  • Affects only eclipse, but on all workspaces.

  • Configures all GUI elements at once.

  • Easily portable to other machines.

  • Reuses work of someone who is surely better in graphical design as you.


Cons:



  • As far, no that I knew.




 


No comments:

Post a Comment