Reduce effective area of touchpad on Linux

cool_penguin_smallHaving a large laptop touchpad poses severe threat to typing. My touchpad is quite sensitive and whenever the lower areas of my palm touch the touchpad the pointer moves away. While the brilliant engineers at Sony designed this, it is counter-productive. And moving around with a mouse (when you have a touchpad) doesn’t see like a bright idea to me.

This morning I was quite determined to fix the problem, even if it needs a hook in the driver. Turned out if your touchpad uses the Synaptics driver, you can reduce its effective area easily. There is a userspace utility to change the parameters at runtime.

Get the default x and y axis range for your touchpad:

$ less /var/log/Xorg.0.log | grep -i range
[ 20.616] (--) synaptics: SynPS/2 Synaptics TouchPad: x-axis range 1472 - 5638 (res 37)
[ 20.616] (--) synaptics: SynPS/2 Synaptics TouchPad: y-axis range 1408 - 4714 (res 59)

As you can see from the results, for me the width is 5638 and height is 4714.

I adjust these as below:

$ synclient AreaRightEdge=5000 AreaLeftEdge=2000 AreaBottomEdge=4000

The arguments are self-explanatory. If you want to adjust the upper limit, use AreaTopEdge.

Enable two finger scrolling for a better experience.

Control brightness on Sony VAIO (kernel 3.16 & above)

cool_penguin_smallHere’s my earlier article on how I used to control brightness on a Sony VAIO SVS13112ENB. However, the method broke after upgrading to kernel version 3.16 from the Ubuntu mainline kernel PPA. I am using Ubuntu 14.04 64-bit. Trying to find an alternative I made the following changes to the scripts in the past article:

  • The line below went into a script that runs at login:
    echo 200 | sudo tee /sys/class/backlight/intel_backlight/brightness
  • The br+ script is modified as:
    curval=`cat /sys/class/backlight/intel_backlight/brightness`
    if [ $curval -ge 700 ]; then 
    echo already max
    `echo $(expr $curval + 50) | sudo tee /sys/class/backlight/intel_backlight/brightness`
  • The br- script is modified as:
    curval=`cat /sys/class/backlight/intel_backlight/brightness`
    if [ $curval -le 100 ]; then
    echo already min
    `echo $(expr $curval - 50) | sudo tee /sys/class/backlight/intel_backlight/brightness` 

Now you can try the hotkeys to verify that the brightness is changed as expected.

Toggle Sony VAIO touchpad on Ubuntu 14.04

ubuntu_logo_81x81In case the older method to toggle (alternate enable disable) the touchpad is not working on Ubuntu Trusty (didn’t work for me), use the following modified script and add a keybind or keyboard shortcut to execute the script:

SYNSTATE=$(synclient -l|grep TouchpadOff|cut -d = -f2)
if [ $SYNSTATE = 0 ]; then synclient TouchpadOff=1
else synclient TouchpadOff=0

Font rendering on Ubuntu. My way!

ubuntu_logo_81x81Default fonts on Ubuntu are not everyone’s cup of tea. While there may be many reasons behind that like patent violation issues, user choices and the OS philosophy, I just wanted my fonts to look sharp and crispier like that in Windows. The default slightly blurred over-hinted fonts on Ubuntu didn’t work for me. So here’s everything I did to make the fonts look like I want them to. I am using the LXDE desktop environment on Saucy. My system font size is 9. My laptop is a Sony VAIO SVS13112ENB.

How to get the best sharp font rendering on Ubuntu?

  • I set the system font to Ubuntu everywhere with variations like Bold, Regular etc. It does look good and using the same font across the system reduces memory and CPU usage. The package is ttf-ubuntu-font-family.
  • The next thing I did was install the Microsoft core fonts package. There might be controversies about using those etc. but they look better. Hands down! Many websites use these fonts as default which helps during browsing. Having them installed also enables me to use the same fonts in Google Docs across different systems. The package to install is ttf-mscorefonts-installer.
  • My font dpi is set to 96. To check yours, use:
    $ xdpyinfo | grep inch
    resolution: 96x96 dots per inch
  • In order to change the dpi at login, run the following in a startup script:
    $ xrandr --dpi 96
  • Created a new font configuration file to override almost all other font rendering settings through fontconfig:
    File: /etc/fonts/conf.d/99-sharp-fonts.conf

    <!--?xml version="1.0"?>-->
    <!--DOCTYPE fontconfig SYSTEM "fonts.dtd">-->
      <match target="font">
        <edit name="antialias" mode="assign"><bool>true</bool></edit>
        <edit name="hinting" mode="assign"><bool>true</bool></edit>
        <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
        <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
        <edit name="rgba" mode="assign"><const>rgb</const></edit>
  • Made the same changes in a new file for Cairo applications which do not obey fontconfig settings.
    File: /etc/X11/Xresources/sharp-fonts

    Xft.antialias: true
    Xft.hinting:   true
    Xft.hintstyle: hintfull
    Xft.lcdfilter: lcddefault
    Xft.rgba:      rgb
  • Settings in LXDE Start Menu ▸ Preferences ▸ Customize Look and Feel ▸ Font:
    //Google Chrome seems to follow this
    Enable antialiasing: Enabled
    Enable hinting     : Enabled
    Hinting style      : Full
    Sub-pixel geometry : RGB
  • Besides the high quality Ubuntu font family, two other fonts which look stunningly beautiful on Ubuntu are Noto Sans, Open Sans, Arimo and Istok. My personal choice for the desktop is Noto Sans and Terminus for the terminal.
  • Logged out and in for the new settings to take effect. Finally I managed to make the fonts look beautiful… my way.
  • To verify the system settings, run:
    $ xrdb -query | grep Xft

Firefox fonts

To get the best possible rendering from Firefox, go to about:config and set the following

browser.display.auto_quality_min_font_size > 0


Fix Intel HDA controller low volume on Linux

audioIf you are experiencing low volume at maximum limit on a machine with HDA controller the way to get a high volume is to reset all the raw pin settings to default. HDA Analyzer does that for you. Before moving on from here, be sure you know what you are doing. This may lead to critical unforeseen issues.

First you need to make sure you have HDA. Run this:

$ lspci|grep -i audio
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series
Chipset Family High Definition Audio Controller (rev 04)

Once you have confirmed, download the HDA Analyzer script ( and run it as root. It will download some other scripts and then you will get the GUI showing all the detected cards, codecs and nodes. If you already know which pins to tweak around with you can directly do that. Otherwise just click on all the different nodes and then exit the GUI (a quicker way is to select the first node and then use the Down arrow key to traverse through all). Before exiting it will ask you the following:

HDA-Analyzer: Would you like to revert settings for all HDA codecs?

Click Yes. Now check if there is a gain in max volume. My volume level increased heavily on a Sony VAIO with the above controller. And you can still gain more by using software Amplification from Ubuntu Sound Settings if you are on Ubuntu. Just don’t blast your speakers literally! 😉

N.B.: the settings are not stored across reboots on all distros. A solution is discussed here. But be very cautious. There may be side effects.

Another possible solution

Edit /etc/modprobe.d/alsa-base.conf as root. Search for the following line:

options snd-usb-caiaq index=-2

Add the following line below it

options snd-hda-intel model=3stack

Use brightness keys with LXDE (Ubuntu on Sony VAIO)

lxdeMy brightness keys were not working out of the box when I switched to LXDE from Unity. Though I keep the brightness constant, I still wanted to make it work in case I need to change the level anytime. I kept the range between 5 to 50 as those limits are fine for me. Here goes how I did it with simple scripts.

The following script (br+) increases the brightness:


curval=`pkexec /usr/lib/gnome-settings-daemon/gsd-backlight-helper \

if [ $curval -ge 50 ]; then
echo already max
`pkexec /usr/lib/gnome-settings-daemon/gsd-backlight-helper \
--set-brightness $(expr $curval + 5)`

The script (br-) to decrease the brightness:


curval=`pkexec /usr/lib/gnome-settings-daemon/gsd-backlight-helper \

if [ $curval -le 5 ]; then
echo already min
`pkexec /usr/lib/gnome-settings-daemon/gsd-backlight-helper \
--set-brightness $(expr $curval - 5)`

Made both the scripts executable and moved to /usr/bin as root. The next step was to find the key mappings for the brightness keys. The tool I used to find that out is xev. It revealed that the keys are XF86MonBrightnessUp and XF86MonBrightnessDown. So I added the following in ~/.config/openbox/lxde-rc.xml along with other keybind actions:

<keybind key="XF86MonBrightnessUp">
  <action name="Execute">

<keybind key="XF86MonBrightnessDown">
  <action name="Execute">

That’s it! Just relogged-in and had functional brightness keys! You can download the scripts from here. It’s tested it on a Sony VAIO SVS13112ENB running Ubuntu 13.04 (Raring).

Suspend on lid close on LXDE, Ubuntu

lxdeBy default LXDE does not suspend the laptop on lid closure. I was trying to enable suspend on sleep as most of the time I close the lid when I am not using the laptop. It saves power and at the same time resume is faster as everything is still in RAM. The event responsible for lid closure or open is button/lid. What you need to do is to bind it with an action to suspend the laptop. However you need to take care that suspension is done only on lid closure. Here’s what I did on Ubuntu 13.04 as root:

  1. Add the following in /etc/acpi/events/lid:
    action=/etc/acpi/actions/ %e
  2. The directory for action scripts may not exist by default on Ubuntu. Create it:
    mkdir -p /etc/acpi/actions
  3. Add action to suspend when the event occurs. Create /etc/acpi/actions/ and add:
    echo "$1" | grep -q open /proc/acpi/button/lid/LID0/state && exit 0
    sleep 2
  4. Make the script executable and restart the acpid service:
    chmod +x /etc/acpi/actions/
    restart acpid

Useful links:

LXDE on steroids!

While Unity has come a long way to silence its initial critics (I was one of them), I was still looking for an alternative desktop environment which is minimal and superfast. I spent the last weekend trying out and customizing the LXDE desktop environment with Openbox as window manager. To my excitement, I could get the same look and feel as SliTaz.

Power tips to customize LXDE as the perfect desktop.

Installing LXDE on stock Ubuntu is simple. Just select the package lxde from synaptic and install it. From the cmdline:

$ sudo apt-get install lxde

Once done, log out and login back selecting the LXDE desktop environment.

The Linux Mint LXDE PPA seems to maintain more recent packages than in the default Ubuntu repos. To install the latest packages, run:

$ sudo apt-add-repository ppa:mati75/mint-lxde
$ sudo apt-get update
$ sudo apt-get upgrade

I edited ~/.config/openbox/lxde-rc.xml to add keyboard shortcuts to turn screen or touchpad off. Some useful keybinds:

  • Windows  Super_L (in case you are used to it due to Unity)
  • ASSIST  Help (on Sony VAIO)
  • WEB  XF86HomePage (on Sony VAIO)

To get the changes in lxde-rc.xml into effect immediately, run:

$ openbox --reconfigure

Now let’s discuss the look and feel. I keep changing the theme, icons etc. occasionally for some variety and not to get bored watching the same desktop regularly. I found the following themes and iconsets give LXDE a stunning look:

  • Adwaita-X (Gtk theme)
  • Evolve & Evolve-Darker (Gtk theme)
  • Zukitwo (Gtk theme)
  • +1_25032013 (Gtk theme)
  • Vertex (Gtk theme)
  • Zorin OS 8 (Gtk theme)
  • Elementary OS Openbox (Openbox theme)
  • 1977 Openbox (Openbox theme)
  • Zukitwo Box (Openbox theme)
  • Ambiance Crunchy (GTK3 Openbox theme)
  • Elementary (icons from Elementary OS)
  • libreoffice-style-sifr (cool LibreOffice theme in default repos)
  • Vibrancy Colors (Gtk icon Theme)

I brought own the panel height to 18 along with icon size 16. More space for activities! CPU temperature varies between 42-50°C during normal usage. I have also installed preload recently. I didn’t add any mixer for volume control, the default keys just work fine. I can toggle the microphone with the following command:

$ amixer set Capture toggle

If you want a mixer pavucontrol is the best option.

If you want to remove Firefox borders completely (saves a lot of space since Firefox 29) for maximum screen space, you can do that. It removes the maximize, minimize and close buttons but shouldn’t be a big problem because you can click on the panel to do these. In addition, you can press <Alt-Space> to get the Window menu. Once again, you need to edit the lxde-rc.xml file and add the following within applications tag:

<application class="Firefox">

For more control on the Firefox Australis theme (introduced in version 29) use the HTitle or Hide Caption Titlebar Plus extension.

After updating to Saucy, I faced an issue with window placement. They do not open centered any more. To fix it, add the following in lxde-rc.xml:

<application class="*" type="normal">
<position force="yes">

To change or add default programs to handle mime types, edit ~/.local/share/applications/mimeapps.list.

To configure the LXDE main menu, edit:

To control apps which would autostart, use:

The system responsiveness and speed is incredible along with all this on LXDE. Without preload the memory usage immediately after a cold boot is 153MB and applications open and run in a snap!!!

Disable keyboard backlight on VAIO SVS13112ENB

ubuntu_logo_81x81Once I upgraded to the Ubuntu mainline kernel 3.9.0-030900-generic, my laptop keyboard backlight won’t go off in certain lighting conditions even if I am not typing anything. So I decided to turn it off completely till the synaptic kernel version catches up. To do this, append the following in GRUB_CMDLINE_LINUX_DEFAULT of /etc/default/grub on Ubuntu 13.04:


The problem is now fixed, but it’s surprising. I added the following in /etc/default/grub:


timeout=0 means 10 seconds and that’s the default. But it doesn’t seem to work on the mainline kernel. timeout=1 works as expected.

Some useful links:

Sony VAIO SVS13112ENB touchpad on Ubuntu

ubuntu_logo_81x81By default the <Fn-F1> key combination to toggle touchpad doesn’t work on SVS13112ENB. To use an alternative key combination do the following:

1. Run xinput:

$ xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ PixArt USB Optical Mouse                	id=9	[slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad              	id=11	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Video Bus                               	id=6	[slave  keyboard (3)]
    ↳ Sony Vaio Keys                          	id=7	[slave  keyboard (3)]
    ↳ Power Button                            	id=8	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=10	[slave  keyboard (3)]

2. Add the following to a script (copy the full text below to any text editor to see it fully):

SYNSTATE=$(xinput list-props "SynPS/2 Synaptics TouchPad" | grep Enabled | grep -Eo '.$')
if [ $SYNSTATE = 0 ]; then
    xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 1
    xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 0

3. Assign a keyboard shortcut to execute the script whenever needed.