Friday, January 13, 2012

Make Eclipse look better on Ubuntu

  • Compact the look and fix unreadable selected entry in content assist in some themes (e.g. Ambience) by creating a new text file called "gtkrc" (a stylesheet file for GTK apps) with the following content:- 
gtk-color-scheme = "selected_text_color:#000000"
style "compact"
{
  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=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"
  text[SELECTED] = @selected_text_color
}
class "GtkWidget" style "compact"
style "compact2"
{
  xthickness=1
  ythickness=1
}
class "GtkButton" style "compact2"
class "GtkToolbar" style "compact2"
class "GtkPaned" style "compact2" 
  • To use the above stylesheet with Eclipse (my version is Indigo - 3.7.1), run Eclipse like this:-
GTK2_RC_FILES=$GTK2_RC_FILES:/somewhere_1/gtkrc /somewhere_2/eclipse
  • Make tooltip readable by using #000000 as its foreground colour (tooltip_fg_color) and #f5f5b5 as background (tooltip_bg_color) in the following files:- 
/usr/share/themes/<your-current-theme>/gtk-3.0/settings.ini
/usr/share/themes/<your-current-theme>/gtk-3.0/gtk.css
/usr/share/themes/<your-current-theme>/gtk-2.0/gtkrc
  • Install Eclipse theme colour plugin and may want to try my TumCode theme which keeps the number of colours to the minimum.
     
  • Replace the default "Monospace" font with "Liberation Mono" and optionally reduce the font size to 8 or 9.
Windows -> Preferences -> General -> Appearance -> Colors and Fonts
(for Java Editor Text Font, Javadoc display font, Properties File Editor Text Font, etc.)

Here is how it looks after the above changes:-

Refs
http://blog.xam.dk/?p=70 
http://askubuntu.com/questions/70599/how-to-change-tooltip-background-color-in-unity
http://blog.valotas.com/2010/02/eclipse-on-linux-make-it-look-good.html

3 comments:

  1. You should not be editing /usr/share/themes/*, instead add to your eclipse gtkrc:


    style "gnome-color-chooser-tooltips"
    {
    bg[NORMAL] = "#FFFFAF"
    fg[NORMAL] = "#000000"
    }
    widget "gtk-tooltip*" style "gnome-color-chooser-tooltips"

    ReplyDelete
    Replies
    1. Worked like a charm in Fedora 18
      Eclipce: (Version: Juno Service Release 2
      Build id: 20130225-0426:)
      java version "1.7.0_15"
      Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
      Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

      Created file gtkrc:
      -- cut --
      style "gnome-color-chooser-tooltips"
      {
      bg[NORMAL] = "#FFFFAF"
      fg[NORMAL] = "#000000"
      }
      widget "gtk-tooltip*" style "gnome-color-chooser-tooltips"
      --end cut --

      $GTK2_RC_FILES=/gtkrc
      $export GTK2_RC_FILES
      $./eclipse

      Delete
  2. Any way of getting this to work in a Windows environment?

    ReplyDelete