Making Eclipse look good on Linux

Java
Max Rydahl Andersen

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...;)





Comments

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.

Max

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

style &#8220my-default&#8221
{
GtkTreeView::horizontal-separator = 0
GtkTreeView::vertical-separator = 0
}
class &#8220GtkTreeView&#8221 style &#8220my-default&#8221

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.

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!

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"

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 ;)

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.

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 :-)

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.

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.

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.

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.