Gnome Power Manager Hides Do Nothing

Found this rather handy post that tells you what to do in newer versions of Gnome Power Manager, which for some reason hide the Do Nothing options as default.

Personally I find it irritating as the battery readout in all the distros of Linux I’ve used on my Eee report the battery at 0% over half an hour before the battery is actually dead.  No amount of conditioning or software modification seems to fix it, so I’m living with it.

However, with the newer versions of Gnome Power Manager, Do Nothing is hidden!  So my machine would go to sleep, despite the fact I know there’s at least 30 more minutes of battery life going to waste.  So annoying!

To fix it (albeit temporarily), you need to edit the gconf values for the settings you’re interested in to “nothing”.

The easiest way to do this is to use an application like gconf-editor and edit the values through that:

  1. Run gconf-editor.
    • If you don’t have it installed, go to your favourite package manager and install it through that.
  2. Using the column on the left side, navigate to apps > gnome-power-manager.
  3. In my case, I wanted to change the critical battery behaviour to Do Nothing.  So I navigated in to actions and set the value of critical_battery to nothing.
    • If you want to change, say, the behaviour of a power button press, navigate to buttons instead of actions.
    • Repeat this step for each value you want to change.
  4. Close gconf-editor.

That’s it!  One thing you need to keep in mind is that if you later change the setting away from Do Nothing to something else, the Do Nothing option will disappear.

Hope this works for you as it has me.

(I’m typing this post with 0% battery left!  What I crazy daredevil I am.)

Update 19:58: Forgot to mention that Do Nothing will disappear if deselected.  Fixed.

Introducing BitButcher — An Open-Source NDS ROM Trimmer

I’ve always wanted to make a software headline like that.  Eee!

Welcome to BitButcher, a small program designed to do one thing and one thing well: trim Nintendo DS ROMs.

I got a bit fed up of the ones already out there, most because they were either closed-source or they had bad GUI design combined with clashing backgrounds.  Search as I may, I couldn’t find anything that fit my demands.

So I did what any self-respecting programmer would do — code my own!

This program is rather simple, but it’s designed to be just that.  Oh, and fast.  Very fast.

Trimming the excess fat off of DS ROMs isn’t exactly a hardest task in the world, but I figured that people would still be interested in what I have made.  As such, I have made the code entirely open-source under GPLv3.

It’s coded in Java, meaning I get cross-platform support for free!  It is however command-line only, so don’t expect any amazing GUI.

If you want to get hold of the program, or would like to help contribute to a better trimmer, then just head over to GitHub:

http://github.com/XanderXAJ/BitButcher

Any help improving the program would be welcome and awesome.  In addition, you can also report any issues you have at GitHub, on the Issues tab.

That’s it for this time — hope you manage to shave off some bytes!

Take Control of Your Settings — Configuring Synaptics Touchpads and Making GNOME Respect Them

The Problem

Today I’ve been trying to configure the touchpad on my Eee PC 901 to my liking.  It’s a Synaptics touchpad, and supports tracking multiple fingers, and I wanted to take more advantage of that.

GNOME does have support for configuring multiple finger gestures out of the box, with gnome-mouse-properties (or System » Preferences » Mouse) and then selecting the Touchpad tab.  This is all good and works fine — if you like what GNOME gives you.

Unfortunately I wasn’t.  When you enable clicking on the touchpad, GNOME sets one finger taps to left-click, two to right, and three to middle.  I tend to use middle-click more often than right-click, thanks to browsing the web and liking making new tabs, plus I already have a dedicated right-click button.

So I set off to change it.  After reading material courteousy of Arch Linux’s wiki, I found (and remembered from attempting the same thing ages ago) that configuration is done through the HAL using fdi policies, which are just specifically formatted XML files.  (The old xorg.conf way is deprecated and isn’t as flexible, not that it matters for configuring the trackpad.)

It sounds scary and involves more typing, but in the end it’s just as simple as process as it used to be, even if it involves jumping through an extra hoop or two.

Configuration

First you have to create a file with the fdi extension in /etc/hal/fdi/policy/.  I’ve named my file 99-synaptics.fdi, following example from /usr/share/hal/fdi/policy/10osvendor/, but you can name yours whatever you like.

sudo gedit /etc/hal/fdi/policy/99-synaptics.fdi

Note: You need root permissions to be able to create and edit this file.  If you run Ubuntu (or are in the /etc/sudoers file), this can be accomplished using the sudo command as shown above. You can use whatever editor you like, too. vi, emacs, nano, kate

Once the file is created, it’s time to get messy!  The fdi file contains a match rule, which tells HAL which device you want to configure, and then a series of merge rules which apply your desired configuration into the HAL.  The easiest way to show this is by example, so here’s my prospective configuration:

<?xml version="1.0" encoding="utf-8"?>
<deviceinfo version="0.2">
 <device>
 <match key="info.product" contains="Elantech Touchpad">
 <merge type="string" key="input.x11_driver">synaptics</merge>
 <merge type="string" key="input.x11_options.VertTwoFingerScroll">true</merge>
 <merge type="string" key="input.x11_options.HorizTwoFingerScroll">true</merge>
 <merge type="string" key="input.x11_options.TapButton1">1</merge>
 <merge type="string" key="input.x11_options.TapButton2">2</merge>
 <merge type="string" key="input.x11_options.TapButton3">3</merge>
 <merge type="string" key="input.x11_options.ClickFinger1">1</merge>
 <merge type="string" key="input.x11_options.ClickFinger2">3</merge>
 <merge type="string" key="input.x11_options.ClickFinger3">2</merge>
 </match>
 </device>
</deviceinfo>

Starting from the top, here’s a quick description of each part:

  • The <?xml part is the XML declaration required in any valid XML file.  Nothing interesting here.
  • The <deviceinfo> and <device> are just boilerplate code that tell the HAL to expect rules relating to devices. Again, nothing interesting here.
  • Now things start getting good!  The <match> line describes how to find the device you want to configure:
    • Simply put, the HAL searches for the contains string inside the key field.  Whatever matches that search it’ll apply the merge rules to.
    • There are other ways to match aside from contains, but this is all you need to know to get things working.
  • The <merge> lines are the meat of the file, describing each and every configuration change you want to make.

You’re probably thinking this is all good and well, but how did I come up with this stuff in the first place?  Well, the answer lies in the HAL itself.

The lshal command lists all the devices the HAL can detect (that’s “ls hal”, get it?).  You might want to pipe the contents to less, to be able to scroll and search through the large amount of text that’s returned:

lshal | less

In less, type /synaptics to search for the string “synaptics”.  less should automatically scroll to the point we’re interested in; your touchpad.  If it cannot be found, you either don’t have a Synaptics touchpad or the synaptics driver isn’t being loaded.  Try searching for Touchpad or similar words, but anything more than that is beyond the scope of this article.

Once you have found the device on your list, you’ll be able to see a list of keys and their values.  You want to pick one of these fields that will not change between boots to place as the match rule inside your fdi file.  I chose info.product, but you can choose something else like input.product if it strikes your fancy.  Either way, fill in the <match> line with the key that you chose and the string that’ll match it.  Ideally this search will only match your touchpad and nothing else.

Next is the fun part — configuration. To do this simply open up the man page for synaptics:

man synaptics

This’ll give a detailed list of everything that can be changed within the synaptics driver.  For each value that you want to change, find its name on the manpage, and add a new merge rule with the appropriate key.  Note that every key in the fdi begins with “input.x11_options.” followed by the synaptics key you want to change.  (The exception to this in my file is the first merge rule, which just makes sure that the synaptics driver has been loaded for my touchpad.)

If you want to test an option before making it permanent, use the synclient key=value command, filling in key and value with the option you want to change.

Once you’ve added all the merge rules you like, close all the tags and save the file.  Now just restart the HAL (or your computer) and your settings will be applied.  Almost.

GNOME Respect

Now that you have your configuration all set up, you need to stop GNOME from changing your carefully crafted settings to ones of its choosing.

To do this, simply run the following command:

gconftool-2 --type bool --set /apps/gnome_settings_daemon/plugins/mouse/active false

If you get cold feet and want to enable GNOME’s control over mouse and trackpad settings, run this command:

gconftool-2 --type bool --set /apps/gnome_settings_daemon/plugins/mouse/active true

That’s really it.  Thanks to jan for finding this value.

I’ve written this to be as generalised as possible, so it should work for many different distros so long as they are using the latest HAL/Xorg/kernel.  I’m running Fedora 11 and have added my name to the /etc/sudoers file, allowing me to run sudo.

If you have any questions or just want to say thanks, feel free to leave a comment or contact me!

<?xml version=”1.0″ encoding=”utf-8″?>
<deviceinfo version=”0.2″>
<device>
<match key=”info.product” contains=”Elantech Touchpad”>
<merge type=”string” key=”input.x11_driver”>synaptics</merge>
<merge type=”string” key=”input.x11_options.VertTwoFingerScroll”>true</merge>
<merge type=”string” key=”input.x11_options.HorizTwoFingerScroll”>true</merge>
<merge type=”string” key=”input.x11_options.TapButton1″>1</merge>
<merge type=”string” key=”input.x11_options.TapButton2″>2</merge>
<merge type=”string” key=”input.x11_options.TapButton3″>3</merge>
<merge type=”string” key=”input.x11_options.ClickFinger1″>1</merge>
<merge type=”string” key=”input.x11_options.ClickFinger2″>3</merge>
<merge type=”string” key=”input.x11_options.ClickFinger3″>2</merge>
</match>
</device>
</deviceinfo>

Stop Exact Audio Copy Crashing on Windows 7

When I tried to rip a disc using Exact Audio Copy on Windows 7 x64, I found it kept crashing as soon as the rip tried to start.  Bummer.

Remembering the previous times I’ve used EAC, when you click a button to start a rip, it asks you where you want to save the ripped files.

Turns out if you set EAC to save into a predetermined location instead of asking, EAC manages to rip perfectly fine!

So, here’s a step-by-step guide to stop it crashing:

  1. Open Exact Audio Copy.
  2. Go to File > EAC Options.
  3. Click the Directories tab.
  4. Instead of “Ask every time”, choose Use this Directory, and pick a directory of your choosing.
    • I personally use C:\Users\<Username>\Music\Extracted
  5. Click OK.

That’s it!  Good luck.

Delete Songs From Smart Playlists in iTunes

Update 2009-11-23: Corrected Mac keyboard keys.  I don’t own a Mac myself, but a friend of mine tells me that iTunes defies the normal behaviour of many other Apple applications. Probably because it’s ancient and desperately needs an update.

Made a smart playlist to find songs you want to delete, then found that the delete function no longer works?

Just hold Shift. Or Option.

Pressing Shift+Delete on Windows or Option+Delete on Mac will give you a prompt to delete songs just like any other delete operation performed in the library.

Holding Shift on Windows or Option on Mac and right-clicking on one or more songs will show “Delete” in the context menu.

As an aside, this shortcut also allows you to delete songs from static playlists as well.

Pinch to Zoom? Nah, I’m Fine, Thanks

What is this generation’s obsession with pinch to zoom?  It’s so often touted as “natural”, “intuitive”, and “cool” that it’s beginning to make me go insane!  Yes, it might be cool, but have the people who say these things even thought implications of both what they say and the use of such an interface?

Intuitive

First, let’s get the bit out of the way that always grates me.  Pinch to zoom isn’t “natural” or “intuitive”, contrary to what people say.  Do people even know what it means?  Let’s have a quick look at the Chambers UK dictionary, since it’s what I have to hand:

intuitive adj having, showing or based on intuition.
intuition noun 1 the power of understanding or realizing something without conscious rational thought or analysis.

Cast your mind back to when you first experienced pinch-to-zoom.  Had you already heard about it from all the marketing and fanboyism?  Did you work it out for yourself?  Did you struggle?

I didn’t struggle, at least to find it, because I knew about it from the web and friends well before I ever used the gesture myself.  But I was always asking myself why–why is it like this?  I mean, I don’t know about you, but I’ve never bought a map or a picture printed on latex before, and I don’t think it would be a terribly good idea if someone were to do it.  Stretching a map just to be able to see to a larger scale sounds like too much work and ridiculously impractical.

At this point you’re probably thinking I’m taking it too seriously.  Damn right I’m taking it seriously–these are the interfaces that people all over the world use millions of times a day.  Shouldn’t something so prolific be polished to perfection?

A more “intuitive” interface would either be one that we can relate to in real life–such as a magnifying glass–or something that we are already used to–buttons, for example.  The latter is a bad example of intuition however, as the only reason most people can use buttons without any conscious rational thought now is because they have made the conscious ration thought a long time ago.  And as an added bonus, what do most zoom buttons look like?  That’s right: magnifying glasses.

Accessibility

I realise that I am a very fortunate person to be fully able to use my body and interact with the devices in my life easily such as computers or mobile phones.  But if I were ever do gain disabilities–specifically motor disabilities–then I want to damn well make sure that I’ll still be able to use my beloved electronics!

You can probably see where this is going.  Pinch to zoom requires a surprising amount of motor- and hand-to-eye coordination.  And this is coming from a very seasoned gamer!

Break down pinch to zoom into its most basic motions for zooming in:

  1. Locate two physical inputs on either side of the point of interest you want to zoom in on.
    • By “two physical inputs” I mean most commonly a thumb and an index finger or two thumbs.
  2. Move each input away from the point of interest.  If you want to keep the subject in the centre of the screen you need to make sure you move each input an equal distance.
  3. Remove both inputs from the screen without moving them across the screen.

Likewise, do the same for zooming out:

  1. Locate two physical inputs far away from the centre of the screen.  This is typically in the corners to maximise the distance that can be travelled by the inputs.
  2. Pull the inputs closer together, typically until they touch.
  3. Remove the inputs from the screen without moving them across the screen.

Now you might take this for granted, but this is actually quite a difficult operation.  After all, you need to line up your two chosen inputs in relation to the object on the screen that you want to zoom in or our with.  If anyone attempting to do this has any long-standing physical problems, they’ll probably find it hard and annoying.

And that’s before we even consider someone who only has the ability to work with one hand at once–i.e. they have very limited finger motion, but are able to use their arms otherwise okay.  They hold the phone in one hand, and then things become very awkward as soon as they decide they want to zoom.  Taps? Easy.  Swipes? Not too bad. Pinching?  Ah.

Usability

Heck, it can be difficult for fully able people to use the pinch to zoom gesture properly.

To use the iPhone as an example (though all other phones with pinch to zoom fall foul of this), you’ve gone on a walk on a hot summer’s day.  Needless to say the warmth is taking its toll on you, but you’re smart and have come prepared with a drink in hand.  You forget exactly which path it is you’re taking to get to your destination, so you pull out your iPhone in your other hand, fire up the Maps app and do a quick search.  There seem to be a lot of junctions ahead…  So you decide to zoom in to see which–ah.

If you’ve ever tried to pinch a phone’s screen whilst hold it in the same hand, you know it’s a challenge to try and hold a device as big as the iPhone and lay two fingers on it and move those fingers precisely.  Even the fact that I am trained in the Monster Hunter “claw”–named for the PSP game’s awkward controls featuring movement on the analogue stick and camera adjustment on the D-pad– didn’t help me at all.  Trying to use it with one hand is just plain awful.  And that’s a big shame, as being able to use a phone one-handed is a big feature for me.

The problem is only exacerbated by circumstances such as driving.  With Android 2.0 recently being announced to have full in-car GPS support, including a special mode which makes buttons larger and a voice speak directions, it’s becoming even more likely that devices with pinch to zoom being used in the car.  Now granted that having buttons to zoom won’t work great unless they’re quite large.  Pinching to zoom however is even worse in that it needs two fingers, both of them to be on and stay on the screen until you’ve hit the zoom level you want.  Now this is going to take concentration and attention.  Probably quite a lot of it.  And driving with your attention off the road isn’t exactly the best idea in the world.  Not the worst, but not the best.

One other thing I haven’t mentioned is multi-touch gestures being implemented on devices that aren’t phones, such as laptops.  I’ve been using 3-finger gestures on my Asus Eee PC 901 for over a year now (yes, there is space for three fingers on the trackpad–just), and there were new MacBooks released earlier this year with support for 4 points of contact!  That’s pretty cool, and I am very much keen on the idea of being able to do lots of different gestures with multiple fingers.  However, when you start to implement many that are similar to each other, people are bound to activate one when they meant to do another.  It’s just a shame sometimes that the people who make these devices know better than you, so much so that they don’t let you adjust anything to your preferences.

So just remember when you next think about pinch to zoom about what I said earlier: it is a gesture that people all over the world use millions of times a day–so long as you have good motor proficiency, hand-to-eye co-ordination, and two hands free.

I am Your God; BOW DOWN TO ME

My fantastical image called “I am Your God; BOW DOWN TO ME”. Shame the link is broken or you've disabled images.

Another of my friends chilling down at the river.

Where there’s food, there’s fighting.

Where there’s bread, there’s dread.

The Windows 7 Taskbar — Keyboard Goodness

If you’re fortunate enough to be using Windows 7, then no doubt you’ve noticed the new taskbar.  Well, here’s a couple of golden nuggets of info for you:

Did you know that all the icons you line up on the taskbar automatically get keyboard shortcuts?  If you want to launch one of them, just press the Windows key and the number of the program’s position along the list.  So to launch the first program, press Win+1; to launch the second, press Win+2; this continues all the way up to Win+0, which opens the tenth program.  Cool, huh?  This is the same behaviour as the Quick Launch Bar in Windows Vista (which I used extensively).

Even better, if you want to open one of those programs with admin permissions (for example, using Notepad to edit the hosts file), you can press Win+Ctrl+Shift+<Number>, accept any UAC prompt, and voilà!  Program a la admin.

I love keyboard shortcuts.

A Word of Warning: Check Your Windows 7 Backup Settings

Backups in Windows 7 have been greatly improved, what with the fact you can restore from them (without needing to take a separate backup) and that they backup to networks better.

However, there has been one change which caught me out, thanks to a subtle and ambiguous rewording of the backups dialog.

When backups are taken, as default only user folders that were created by Windows are backed up.  For reference that’s Appdata, Contacts, Desktop, Downloads, Favorites, Links, Music, Pictures, Saved Games, Searches and Videos.

This is different from the default behaviour of backups in Windows Vista, which backed up everything in C:\Users\<Your Username>

If you make any folders of your own at the root of your user folder, they will NOT be backed up.  If you want to back those up, I recommend you go through the backup wizard again and say that you want to configure what gets backed up yourself.  Select more locations, and navigate through the filesystem until you check C:\Users\<Your Username>.

I lost a few files when I reinstalled 7 for unrelated reasons, and lost the contents of my Code and Programs folders.  I’m lucky that I had only been using the OS for a couple of weeks–had I been using it longer I could have lost a lot more.  At least it’s given me an excuse to code!

Just a friendly warning for fellow Windows 7 users who are as fussy about file organisation as I am.

Adding your most recent Twitter tweet to your Pidgin status

This guide is intended to be a more up-to-date mirror of the guide you can find at Tech Jawa.  All credit to them for the original instructions!

Basically nothing changes, but I just like to be comprehensive.

  1. Download the TwitterStatus plugin.  It’ll be a file ending in .pl.
  2. Move this file to your Pidgin plugins folder.  If any folders don’t exist, create them:
    • Linux: ~/.purple/plugins/
    • Windows Vista/7: C:\Users\<Username>\AppData\Roaming\.purple\plugins
  3. Install Perl:
  4. Install  the XML::XPath module into perl:
    1. Open a command line.
    2. Run perl -MCPAN -e shell.
    3. Type install XML::XPath and then hit Return.  Wait for the install to finish.
    4. Type quit and hit Return, then close your command line
  5. Start (or restart) Pidgin.
  6. From the contact list, go to Help > About.  At the very bottom of the textbox that appears it should say “Perl: Enabled”.  If it does not, repeat steps 3 and 4.
  7. From the contact list, go to Tools > Plug-ins.  Find Twitter Status on the list, check the checkbox next to it, and then click Configure Plug-in.
  8. In the configuration window that appears, type in your username in the top textbox (labelled Username, surprise surprise).  Configure anything else you want to your liking.

That’s it!  You do not need to set this up again, it is a one-off set up for the computer.  Of course, you will need to go through this procedure again if you have multiple computers you use Pidgin on, or if you format and reinstall your OS.