Driving your firefox like vim

Recently a friend of mine pointed out pentadactyl to me. It's a firefox add-on to drive your browser in a vim-like style. I had tried vimperator in the past and didn't like it very much back then, but a lot has improved since then.

Obviously there's a learning curve involved, like in many great tools, but I think for me it was worth it. I have it now enabled in all my firefoxes/iceweasels.


Posted Thu Nov 29 19:06:48 2012

Fun and Profit with lirc

Getting the basics

A couple weeks ago I got myself a small USB Infrared Transceiver from the people at iguanaworks. It comes in different models and I got the dual socket one that allows me to hook up external IR emitters. The goal was to remote control my stereo from my desktop machine, so using wired IR blasters gives me the flexibility I need with the wiring.

They provide Debian packages built for some version of Ubunutu from their website. I wanted to build them from source, so apt-get source from their repository it is. The build process of the package is pretty broken – it assumes there already is an iguanair user for instance. If somebody could package this up properly for Debian that'd be real nice. And who knows, maybe upstream would appreciate that as well. At first glance the software looks free enough.

Once iguanair has been built and installed, lirc needs a recompile – it will pick up the iguanair library automatically.

Their Getting Started docs are actually pretty good.

Learning the IR codes

Anyway, once the software was set up, I needed the IR-codes to send to my Denon.

There are a couple of databases for varios remote controls and receivers on the internet, but I didn't find a single entry for my old Denon AVR-1600RD.

Fortunately lirc alls you to learn codes off a remote control you already have, and since the iguana device also comes with a receiver, I could use irrecord to get the needed magic bytes for commands like power on/off, mute, volume up/down.

This actually worked quite well, the only problem was realizing that the IR blasters are really picky about being properly aligned and close to the receiver (my Denon). Once I got that right, all the recorded codes worked.

lircd.conf for Denon AVR-1600RD

Putting it all together

I can now use this to mute my stereo using irsend send_once denon KEY_MUTE for instance.

What I also wanted to get out of this was that the stereo should be shut off automatically when my machine goes to sleep, or when I haven't used it in a while.

Since my Denon only has a power toggle command and does not appear to have a discrete power-off command – at least I don't know it – I needed something on my system to keep state, and it means I no longer should use my real remote control or else things will get out of sync.

I have written a small wrapper script that does this for me – stereo. It's in /usr/local/bin.


On boot, the script creates its state file when called with the init command. There is a small init script that takes care of this, as well as turning off the stereo when the machine reboots or powers off.

Power off on suspend

In addition to powering off the stereo when the machine goes down, I also want it to do that when it goes to sleep. Enter /etc/pm/sleep.d/20 stereo.

Power off on idle

Furthermore, I run the script out of cron every 5 minutes - to see if anything is using the alsa device. If there isn't for half an hour the stereo gets turned off. Crontab entry:

*/5 * * * * /usr/local/bin/stereo off-if-idle

Manually controlling it

And last not least I have integrated it into my xbindkeys config. I am abusing a couple special keys that I never ever use. Here's the snippet from my ~/.xbindkeysrc:

"stereo mute"
"stereo vol-"
"stereo vol+"
"stereo toggle"
"stereo touch"


Posted Sat Sep 29 15:21:17 2012

All posts by year