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 :)

Sunday, April 10, 2016

Huawei E3131 on Ubuntu 15.10

This post is about getting the Huawei E3131 usb modem to work smoothly on Ubuntu 15.10. If you are a user who is using this modem you must have experienced that the modem fails to connect on a cold start. You need to unplug it and plug it again after you logged in to get the modem working. Well while doing some digging in the internet i came across the following bug report which helped me to fix the problem.

https://bugs.launchpad.net/ubuntu/+source/usb-modeswitch-data/+bug/1192297

What i did was the following

  • Copy /lib/udev/rules.d/40-usb_modeswitch.rules to /etc/udev/rules.d/40-usb_modeswitch.rules 
  • Edit /etc/udev/rules.d/40-usb_modeswitch.rules and add the following rule at the end of the rule list. Make sure its above the LABEL
# Huawei E3131H
ATTR{idVendor}=="12d1", ATTR{idProduct}=="14fe", RUN+="/usr/sbin/usb_modeswitch -v12d1 -p14fe -J"
  • Comment the following rule as below
# Generic entry for all Huawei devices, excluding Android phones
# ATTRS{idVendor}=="12d1", ATTRS{manufacturer}!="Android", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'"
Thais it with the configuration. Now shutdown the pc and start it to see if it is working :)

Update:

The configuration file is no longer needed since the rule uses the huawei mode switch.