Saturday, April 16, 2016

Perfect GTK styles for Eclipse

Recently i switch to KDE and i had to work on the eclipse gtk settings again to get rid of huge toolbars. But lucky ubuntu forums had lot of help and the following particular forum post helped to solve it.
http://ubuntuforums.org/showthread.php?t=1465712

Now before you start you need to make sure the eclipse is running in gtk2 mode. Basically you can do it with a small shell script as below.

#!/bin/bash
export SWT_GTK3=0
./eclipse
Now you need to create a gtkrc file which you can select any name you like, But i choose it to name as .eclipse-gtkrc-2.0. Now copy the following content into this file and save it.

include "/home/{user.home}/.gtkrc-2.0-kde4"
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
}
style "compact-toolbar"
{
GtkToolbar::internal-padding = 0
xthickness = 1
ythickness = 1
}
style "compact-button"
{
xthickness = 0
ythickness = 0
}
class "GtkToolbar"   style "compact-toolbar"
widget_class "**" style "compact-button"
class "GtkWidget" style "gtkcompact"
{user.home} must be replaced with the user home folder name of yours.

Now update the shell script that you have made to run eclipse in gtk2 mode as follows.

#!/bin/bash
export SWT_GTK3=0
ECLIPSE_HOME=/opt/eclipse/neon/eclipse
GTK2_RC_FILES=~/.eclipse-gtkrc-2.0 $ECLIPSE_HOME/eclipse
Update the paths to suite you and that's it. Your eclipse will look as follows


Enjoy :)

No comments: