Saturday 14 September 2013

Lubuntu Keyboard Shortcuts

The one thing I hate about my lovely ASUS X401A laptop is the touch-pad.

Its just a plastic rectangle that clicks when you press along three of the sides.


I guess there are two problems with my touch-pad:-
  1. Clicking the mouse tends to move the cursor, so I often select the wrong menu option or highlight the wrong text
  2. When typing, the cursor sometimes moves, so text gets inserted in the wrong part of the document (maybe my hands get too close to the touch-pad)
Since the laptop boasts "...palm proof technology..." I suspect my problems are due to either the Linux touch-pad driver, or its configuration settings.

I don't have a solution for the first problem, but it may be as simple as tweaking a few settings, for all I know!

However, a workaround for the second problem is to disable the touch-pad. This should be easy using fn+F9 keys. Unfortunately the fn+F9 combination does not work when running Lubuntu on the X401X.


Disabling The Touch-pad

The Synaptic touch-pad driver can be configured using the command line utility synclient.

You can disable the touchpad using this command, which can be type in a terminal window :-
synclient TouchPadOff = 1

...and to enable it:-
synclient TouchPadOff = 0

To view all options, try typing this into a terminal:-
man synclient

Creating Custom Shortcuts

Lubuntu uses the windows manager 'openbox', and I can configure keyboard shortcuts via the lubuntu-rc.xml file. So although fn+F9 does not work, I can configure new shortcuts to enable/disable the touch-pad.

The lubuntu-rc.xml file is located in: /home/{user}/.config/openbox (so in my case: /home/steve/.config/openbox).

Shortcuts are defined by code blocks like this:-
    <!-- Launch the Calculator app using <Alt> <c> -->
    <keybind key="A-c">
      <action name="Execute">
        <command>galculator</command>
      </action>
    </keybind>


The key definitions include the following examples:-
ctrl is C
Alt is A
shift is S
Win is W

To disable the touch-pad I'll use <ctrl><F9> and to enable it <Alt><F9>

    <!-- Disable TouchPad -->
    <keybind key="C-F9">
      <action name="Execute">
        <command>synclient TouchPadOff=1</command>
      </action>
    </keybind>
    <!-- Enable TouchPad -->
    <keybind key="A-F9">
      <action name="Execute">
        <command>synclient TouchPadOff=0</command>
      </action>
    </keybind>


What else?

While we have the file open we can add a few more shortcuts.

Lubuntu comes with a screen capture utility called scrot, which is normally activated via the Print Screen key. To make this more useful I want any captures to be saved to the desktop:-

    <!-- Launch scrot when Print is pressed & save to desktop -->
    <keybind key="Print">
      <action name="Execute">
        <command>scrot -e 'mv $f ~/Desktop/'</command>
      </action>
    </keybind>


Capturing just the current active window can be achieved like this:-

    <!-- Take a screenshot of the current window with scrot when Alt+Print are pressed -->
    <keybind key="A-Print">
      <action name="Execute">
        <command>scrot '%Y-%m-%d_%s.png' -u -b 'mv $f ~/Desktop/'</command>
      </action>
    </keybind>


...and to capture an area using click + drag:-

    <!-- Take an area screenshot with scrot when Ctrl+Print are pressed -->
    <keybind key="C-Print">
      <action name="Execute">
        <command>scrot '%Y-%m-%d_%s.png' -s -e 'mv $f ~/Desktop/'</command>
      </action>
    </keybind>


...and finally

If you've had a look at the lubuntu-rc.xml file you would have noticed that its already populated with many shortcuts. The problem may be trying to remember them!

You could create a text file listing the more useful options and save it on the desktop. Or maybe take a screenshot of the text showing your list of options, then add this as/to your desktop image.

No comments:

Post a Comment