3

I am running Eclipse Mars on Fedora 24 (Gnome 3.20). What I want to do is to reduce the size of toolbar.

What I felt is the size of toolbar is big because of "Quick Access" text box but I tired to hide it also and it didn't work even after I hide that.

Any help appreciated.

Eclipse toolbar size

4
  • 2
    Yes, but it is not easy. The reason is that there is some problem between the crossplatform gui code of the eclipse and the font sizing gui widgets of the gnome. The eclipse is more complex as it seems, it is a crossplatform, modular gui which is customizable with css. This css you can alter somewhere, and with it you can reach a partial fix. A perfect fix would require a deeper digging of the relevant eclipse modules, unfortunately. Note, this toolbar problem doesn't exist on my current eclipse install (oxygen 4.7 on a linux mint, with around 1920x1200 px desktop).
    – peterh
    Feb 21, 2017 at 5:17
  • Yes I agree eclipse is complicated but we need to find out exact css file and the tag which will change the size of toolbar as per requirement. This happens only in Gnome and not with unity and windows DE. It maybe related with DE also but I dont know exactly.
    – snoop
    Feb 21, 2017 at 5:24
  • Some font handling or screen resolution-based size calculation could be the reason. Good luck!
    – peterh
    Feb 21, 2017 at 8:52
  • Cant we reduce the size of "Quick Access" text box?
    – snoop
    Feb 21, 2017 at 9:13

1 Answer 1

2

Reducing size of toolbar is possible. I wrote following CSS file (taking help from google) to modify Toolbar size:

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"

# Make tabs smaller

style "compact-toolbar" {
    GtkToolbar::internal-padding = 0
    xthickness = 1
    ythickness = 1
}

style "compact-button" {
    xthickness = 0
    ythickness = 0
}

style "compact-default"
{
  xthickness=1
  ythickness=1
}

style "compact-entry"
{
  xthickness=2
  ythickness=2
}
class "GtkButton" style "compact-default"
class "GtkPaned" style "compact-default"
class "GtkEntry" style "compact-entry" 


class "GtkToolbar" style "compact-toolbar"
widget_class "*<GtkToolbar>*<GtkButton>" style "compact-button"

In this CSS the line class "GtkEntry" style "compact-entry" reduces the size of toolbar as per CSS style "compact-entry".

I saved above file by giving name as .gtkrc-eclipse in home directory. After that I wrote script eclipse.sh containing following command to run eclipse with file that we created.

export SWT_GTK3=0
env GTK2_RC_FILES=/usr/share/themes/Adwaita/gtk-2.0/gtkrc:/home/snoop/.gtkrc-eclipse /home/snoop/Mars2/eclipse

Now, calling script using bash eclipse.sh runs eclipse with our CSS style. And modified Eclipse toolbar looks like this:

modified Eclipse toolbar

1
  • 1
    GTK3 is now required by eclipse, this tweak is interesting but may be upgraded in GTK3
    – pdem
    Nov 9, 2018 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.