Search code examples
eclipsegtkgtk2

How can I change vertical spacing in Gtk2 menu items in Eclipse?


I'm trying to make Eclipse UI more compact and already have successfully tweaked it using these instructions:

The only remaining thing I want to improve is reducing vertical spacing between menu items as on this picture:

Eclipse menu items.

I looked through GtkMenuItem style properties, but can't find any setting for that. GtkMenu::vertical-padding also doesn't seem to be right one.

Is there any Gtk2 widget property that I can modify to do it?


Solution

  • There are a couple of settings in your theme's gtkrc file that you can modify to make the menu items more compact:

    1. To reduce the width and height of the menu items, you can assign a smaller value to the xthickness and ythickness properties respectively (horizontal and vertical padding respectively between the text and border of a widget). e.g.

      style "menu_item" {
          xthickness = 1
          ythickness = 1
      }
      

      The above code snippet assumes your GtkMenuItem widget uses a style called menu_item in your theme's gtkrc file. i.e.

      widget_class "*<GtkMenuItem>*" style "menu_item"
      
    2. The height of the separator menu item (line separating menu items) can be reduced by assigning a smaller value to the GtkWidget::separator-height property. e.g.

      style "separator_menu_item" {
          xthickness = 1
          ythickness = 1
      
          GtkSeparatorMenuItem::horizontal-padding = 0
          GtkWidget::wide-separators = 1
          GtkWidget::separator-width = 1
          GtkWidget::separator-height = 1
      }
      

      Again, the above code snippet assumes your GtkSeparatorMenuItem widget uses a style called separator_menu_item in your theme's gtkrc file. i.e.

      widget_class "*<GtkSeparatorMenuItem>*" style "separator_menu_item"