Very large tabs in Eclipse panes on Ubuntu

Andy picture Andy · Aug 4, 2012 · Viewed 41.7k times · Source

My question is very similar to Stack Overflow question Gigantic Tabs in Eclipse on Ubuntu.

I have tried the solutions presented, but they appear to be old. I have found a solution that nicely handles the toolbar and menus, but not a solution that reduces the size and padding of the disproportionately large tabs (and label) within the panes (see the tab "Package Explorer" in the screen below).

I am happy with the way my OS-wide GTK theme is customized and don't want to change that. Is there a quick fix to reduce the tab sizes of the panes in Eclipse?

I'm using Eclipse for Mobile Developers (Juno) on Ubuntu 12.04. I'll also mention that I really like the way Eclipse appears out of the box in Windows 7, so something similar to that would be ideal.

Here are the eclipse specific GTK styles I'm using:

style "eclin" {
    GtkButton::default_border={1,1,1,1}
    GtkButton::default_outside_border={1,1,1,1}
    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=1
    GtkMenuItem::horizontal_padding=4
    GtkToolbar::internal-padding=1
    GtkToolbar::space-size=1
    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=12
    GtkTreeView::fixed-height-mode=TRUE
    GtkWidget::focus_padding=0
    font_name="Liberation Sans,Sans Regular 8"
}

class "GtkWidget" style "eclin"
    style "eclin2" {
    xthickness=1
    ythickness=1
}

class "GtkButton" style "eclin2"
class "GtkToolbar" style "eclin2"
class "GtkPaned" style "eclin2"

Here is a screenshot of what my IDE looks like with the huge tabs:

Eclipse Juno IDE with tabs too big

Answer

konradstrack picture konradstrack · Aug 6, 2012

You can edit Eclipse's CSS instead of messing with the GTK theme.

In your Eclipse directory find the file plugins/org.eclipse.platform_4.2.*/css/e4_default_gtk.css (there's an * in there, because I guess that the version may change in the future or may be different already). In this file there's a CSS class:

.MPartStack {
    font-size: 11;
    swt-simple: false;
    swt-mru-visible: false;
}

And you have two possible solutions:

  1. change font-size to something smaller
  2. just comment out or remove font-size from this class (works well for me)

And that should do the trick.