November 8, 2007 36

Making Eclipse look good on Linux

By in Java

I have been bothered a long time by the “clumsy” look that Eclipse has on my Fedora box compared to how it looks on Windows and Mac.

Eclipse 3.3 running on Windows XP

Windows Sample

Eclipse 3.3 running on Fedora 6 (but looks very similar on other distros)

Windows Sample

Notice that the font size is bigger ( 10 vs 8 ) and that there is alot of extra spacing between elements (The package tree and problem view is much more compact on windows).

I tried changing the GTK themes but the issue prevailed – the themes doesn’t seem to adjust the fonts only the component “look”.

But with some help from my Red Hat friends on our tech-list I got some tips and ended up getting close.

The tweaks

Install Red Hat Liberation fonts which are free/liberated Windows fonts available for any OS and readily available in Fedora’s repositories so they are very easy to install via yum.

After they are installed I ran gnome-font-properties and used the following settings:

Application/Document/Desktop font: Liberation Sans, size 8
Window title font: Liberation Sans Bold, size 10
Fixed with font: Liberation Mono, 10

Font rendering: Best contrast (the others left weird artifacts, but mostly up to taste here I think)

Under details:
Resolution: 99 dpi (to avoid the letters to get too close, need at least 1 px between them ;)
Smoothing: Grayscale

Hinting: Full

Depending on your Eclipse font settings the above will be enough, but if you already have tweaked some settings remember to check your Font settings under Eclipse preferences and verify that you are actually using the System default or the Liberated fonts to get the smoother more compact look.

Eclipse 3.3 with Liberation font + tweaks

Windows Sample

Much better, but unfortunately GTK still thinks it needs to have 1-2 extra pixels between components. If anyone knows any tips on how to reduce that wasted space then please leave a comment ;)

(Now I just need to figure out how to get this more compact look into the distro…;)

  • Boris Bokowski

    Cool!

  • nobody

    How about making Linux look good on Linux first and Eclipse will follow!

  • Max

    For some reason it is actually only Eclipse that looks this clunky – other apps seem to be designed/done with the understanding extra space is added.

    But yes, I would prefer these or similar “compact” settings were available out of the box.

  • me again

    See http://www.codecommit.com/blog/eclipse/one-wild-week-with-ubuntu-linux for a description of how to get rid of space

    Which other app? Is it running GTK?

  • Max

    I tried doing the ~/.gtkrc-2.0 trick:

    style “my-default”
    {
    GtkTreeView::horizontal-separator = 0
    GtkTreeView::vertical-separator = 0
    }
    class “GtkTreeView” style “my-default”

    But it had zero effect as far as I can tell (even after reboot)

  • David Carver

    Under Ubuntu 07.10, just change the point size from the default 10 or 12 points, to 8 points, and use the Sans font. This affects all applications, but my personal preference is for smaller fonts system wide. The default that comes with Ubunutu at higher screen resolutions appears to large.

  • Max

    This is exactly what I did…that does not change the margin’s that GTK adds between components.

  • http://www.willianmitsuda.com Willian Mitsuda

    This is the polishment item #1 which prevents me from switch to Linux definitely.

  • wesley

    edit the config file: ~/.gtkrc-2.0

    style “gtkcompact” {
    font_name=”Sans 8″
    GtkButton::default_border={0,0,0,0}
    GtkButton::default_outside_border={0,0,0,0}
    GtkButtonBox::child_min_width=0
    GtkButtonBox::child_min_heigth=0
    GtkButtonBox::child_internal_pad_x=0
    GtkButtonBox::child_internal_pad_y=0
    GtkMenu::vertical-padding=1
    GtkMenuBar::internal_padding=0
    GtkMenuItem::horizontal_padding=4
    GtkOptionMenu::indicator_size=0
    GtkOptionMenu::indicator_spacing=0
    GtkPaned::handle_size=4
    GtkRange::trough_border=0
    GtkRange::stepper_spacing=0
    GtkScale::value_spacing=0
    GtkScrolledWindow::scrollbar_spacing=0
    GtkExpander::expander_size=10
    GtkExpander::expander_spacing=0
    GtkTreeView::vertical-separator=0
    GtkTreeView::horizontal-separator=0
    GtkTreeView::expander-size=8
    GtkTreeView::fixed-height-mode=TRUE
    GtkWidget::focus_padding=0
    }
    class “GtkWidget” style “gtkcompact”

  • Guanglin Du

    Try *WenQuanYi bitmap font* (http://www.wenq.org/). It was designed for Chinese characters, but looks thin and sharp when used to English fonts. Change all your font settings from System – > Preferences -> Font for Gnome desktop.
    On Ubuntu 6.10 and 7.04: *sudo apt-get install xfonts-wqy*
    On Ubuntu 7.10: *sudo apt-get install wqy-bitmapfont*
    Don’t know how to install this font on Fedora, or the KDE desktop. Sorry, don’t know why I cannot attach the screenshot.

  • bob

    Personnaly I use the Arial (could also be verdana, etc) font at 10pt size, without anti-alising at all *but* with freetype supporting the bytecode interpreter (it’s the case by default with Ubuntu) to have sharp and accurate shapes.
    Doesn’t fix the widget spacing problem though.

    Eclipse should always be delivered with a brand new 24p wide screen!

  • http://farjumper.livejournal.com/ Vladimir Buell

    Thanks, Willian!!

    I’ve tweaked your theme a little for compacting such elements as Toolbars, Statusbars and Editor’s tabs.

    style “gtkcompact” {
    font_name=”Sans 8″
    GtkButton::default_border={0,0,0,0}
    GtkButton::default_outside_border={0,0,0,0}
    GtkButtonBox::child_min_width=0
    GtkButtonBox::child_min_heigth=0
    GtkButtonBox::child_internal_pad_x=0
    GtkButtonBox::child_internal_pad_y=0
    GtkMenu::vertical-padding=1
    GtkMenuBar::internal_padding=0
    GtkMenuItem::horizontal_padding=4
    GtkToolbar::internal-padding=0
    GtkToolbar::space-size=0
    GtkOptionMenu::indicator_size=0
    GtkOptionMenu::indicator_spacing=0
    GtkPaned::handle_size=4
    GtkRange::trough_border=0
    GtkRange::stepper_spacing=0
    GtkScale::value_spacing=0
    GtkScrolledWindow::scrollbar_spacing=0
    GtkExpander::expander_size=10
    GtkExpander::expander_spacing=0
    GtkTreeView::vertical-separator=0
    GtkTreeView::horizontal-separator=0
    GtkTreeView::expander-size=8
    GtkTreeView::fixed-height-mode=TRUE
    GtkWidget::focus_padding=0
    }
    class “GtkWidget” style “gtkcompact”

    style “gtkcompactextra” {
    xthickness=0
    ythickness=0
    }
    class “GtkButton” style “gtkcompactextra”
    class “GtkToolbar” style “gtkcompactextra”
    class “GtkPaned” style “gtkcompactextra”

  • http://www.willianmitsuda.com Willian Mitsuda

    Vladimir, it was Wesley’s response, not mine… And yes, the CSS for comments is confusing ;)

  • http://martin.ankerl.com/ martinus

    Hi there, you can use the Clearlooks Compact theme that I have created especially because eclipse looks so bad:

    http://martin.ankerl.com/2007/11/04/clearlooks-compact-gnome-theme/

  • Max

    I tried using exactly your theme, but I saw no change in the margin used between components.

  • Max

    Hi Vladimir,

    Thanks for this style; but its kinda “overdoing” it since (to me atleast) it result in very narrow buttons/views…I’ll try and adjust it a bit after our next release ;)

  • http://martin.ankerl.com/ martinus

    It should be most visible for the tabs, which are much too high in the default clearlooks theme. You have to restart eclipse for this change.

  • http://aie.pl martel

    Anyone knows how to add these spaces to windows programs? GTK Eclipse looks a whole lot better compared to the cluttered and tight windows eclipse.

  • Max

    hehe – yeah, everyone has their own taste. But sorry – I don’t know of a way to tweak windows “spacing”.

  • http://farjumper.livejournal.com/ Vladimir Buell

    In this case my greetings to Wesley :)

    One question remains for me: How can I bind left and right cursor keys for tree view collapsing and expanding (now only grey plus and minus works)?

  • Kim Sullivan

    Why couldn’t I find anything like this when I was searching for a solution? The only thing I came up was the vertical-separator, which helped a bit (when using default fonts)…. Thanks a lot!

    BTW, When I tried to apply the vertical-separator setting to GTKWidget, gnome started acting really weird (I couldn’t restart it using ctrl-alt-backspace)… I’ll definitely try your theme once I get a working notebook back :-)

  • http://djo-mos.developpez.com djo.mos

    Thank Wesley for the solution ! It works perfectly !
    Just one thing: in gnome 2.2, there is no ~/.gtk-2.0 file by default, so you have to create it manually.
    Regards.

  • http://designparadigm.wordpress.com Andries Inzé

    Great post. Bugged me for ages!

  • Alan

    Thank you so much for your .gtkrc-2.0 settings. This makes eclipse so much nicer to use on my little laptop screen.

  • http://www.uhlala.it Alessio

    sorry but I can’t understand how you find the win version being better than standard linux (gtk) version.
    Extra dimension is for bettere legibility, indeed.
    Take care of your eyes, and trust the default.

  • rick

    You guys are lifesavers! Thanks. The ugliness of eclipse on linux was driving me crazy until I found these gtkrc-2.0 settings.

  • http://blog.sarathonline.com/2008/10/solved-eclipse-looks-good-in-ubuntu-now.html Sarath

    Added an easy way, one simple script and a gtkrc, read here.
    http://blog.sarathonline.com/2008/10/solved-eclipse-looks-good-in-ubuntu-now.html

  • Daniel Verner

    Thank you.

  • sachin poddar

    You guys rock! Provided tweak works perfect for eclipse on my 14.1″ laptop. Thanks a ton :)

  • Alejandro

    I honestly don’t understand folks who prefer the cluttered Windows appearance and the blocky, tiny ass fonts. Really, after you switch to Fedora and learn to live without the straitjacket, your eyes really thank you for it.

    Granted, the default Fedora fonts are too big. However, once you set the font size to 10, the resolution to 96 ppi and install the freetype-freeworld package (a true jewel available from the RPM fusion repos), everything looks fantastic. Recent Ubuntu distros (Jaunty for sure) come with freetype-freeworld (which has patent issues) preinstalled, so you can enjoy the crisp fonts out of the box.

  • Attila Zilizi

    You’r awesome guys! The gtkrc-2.0 setting worked as expected.
    Thank you.

  • Prasad Annadata

    Thank you Vladimir.
    If anyone is planning to use Vladimir’s gtkrc, please note that, when you copy-paste from this webpage, make sure you have the right double-quote characters. It took me a while to figure out why the gtkrc is not affecting the view at all.

  • Jonas

    Please vote for the bug in Ubuntu:
    https://bugs.launchpad.net/ubuntu/+source/eclipse/+bug/653010

    …so this can be fixed where it should be.

  • Pingback: Blog rgawron.pl » Poprawienie wyglądu Eclipse pod Linuksem

  • Felix

    Wesley and Vladimir are true heroes!

  • Seth

    What are you even talking about?

canl sohbet hatt telefonda sex telefonda seks sex erotik sohbet hatt sex sex sex siki porno porno porno porno izle