Can I make Eclipse on Ubuntu look more compact? [duplicate]

馋奶兔 提交于 2019-11-28 15:40:16
Redsandro

I have been looking everywhere for a GTK3 solution, because I was sure the switch to a GTK3 system caused this. However, after two hours of wasting my time, I found out that the 'old GTK2 trick' just works.

The original forum post is here: http://ubuntuforums.org/showthread.php?t=1465712

Add a new file called .gtkrc-2.0 to your home directory with the following content:

style "gtkcompact" {
  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
  GtkTreeView::vertical-separator=0
  GtkTreeView::horizontal-separator=0
  GtkTreeView::fixed-height-mode=TRUE
  GtkWidget::focus_padding=0
}
class "GtkWidget" style "gtkcompact"

Restart Eclipse.

Wasted space back to efficient use!

Update 2014-06

Now that I myself have (finally) moved to Kepler, I found that the little minimize-maximize widgets wouldn't go below 28 pixels anymore. These .gtkrc-2.0 seem to have better results for Kepler.

style "gtkcompact" { 
  GtkButton::defaultborder={0,0,0,0} 
  GtkButton::defaultoutsideborder={0,0,0,0} 
  GtkButtonBox::childminwidth=0 
  GtkButtonBox::childminheigth=0 
  GtkButtonBox::childinternalpadx=0 
  GtkButtonBox::childinternalpady=0 
  GtkMenu::vertical-padding=1 
  GtkMenuBar::internalpadding=0 
  GtkMenuItem::horizontalpadding=4
  GtkToolbar::internal-padding=0 
  GtkToolbar::space-size=0 
  GtkOptionMenu::indicatorsize=0 
  GtkOptionMenu::indicatorspacing=2 
  GtkPaned::handlesize=4 
  GtkRange::troughborder=0 
  GtkRange::stepperspacing=0 
  GtkScale::valuespacing=0 
  GtkScrolledWindow::scrollbarspacing=0 
  GtkExpander::expandersize=10 
  GtkExpander::expanderspacing=0 
  GtkTreeView::vertical-separator=0 
  GtkTreeView::horizontal-separator=0 
  GtkTreeView::expander-size=8 
  GtkTreeView::fixed-height-mode=TRUE 
  GtkWidget::focuspadding=1 
} 
class "GtkWidget" style "gtkcompact"

style "gtkcompactextra" { 
  xthickness=2 ythickness=2 
} 
class "GtkButton" style "gtkcompactextra"
class "GtkToolbar" style "gtkcompactextra"
class "GtkPaned" style "gtkcompactextra"

If you add the xthickness and ythickness to the whole GtkWidget class, your menu bar will be all tight and squeezed together. That's too much in my opinion, but just so you know.

You can edit the file and save it, open up something simple like Geany, tweak save, re-open Geany etc. to quickly tweak this. For details you can open Eclipse every time, but it takes longer to load, depending on how much plugins you have to load.

Update 2015-10-02

About Luna and Mars

@eocanha said at jan 15:

If you have Gtk3 installed, Eclipse Luna will use the Gtk3 CSS based styling system and will ignore .gtkrc-2.0. However, you can force Eclipse to use Gtk2 again (if you have it installed) via shell environment variables: "export SWT_GTK3=0" in your .bashrc or in some wrapper script calling Eclipse.

Original source: https://bugs.eclipse.org/bugs/show_bug.cgi?id=420180

If you want to see more code and less clutter, take a look at the eclipse fullscreen plugin . Toggle the fullscreen mode with Ctrl+Alt+z (or define your own binding).

Instead of using menus, the "universal command" shortcut Ctrl+3 can take you to any menu and perform any task faster.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!