I love my 5 button mouse like no man should love an inanimate object. It’s getting on a bit and starting to go a little yellow, but that’s not the point. When I used this mouse on a Mac I could map the side buttons to Exposé actions, like tile all windows and show the desktop. I want to do the same in Linux, damnit.

With compiz you can do lots of lovely (and some pointless) things. Things like making the windows wobbly, or make it rain flaming globs of semen. I think. What you can’t do is map a mouse button to the show desktop action. Poop.

I searched for a while and came across this page with a very handy little script. A quick correction/update to the syntax and it works a treat.

From the command line

sudo apt-get install wmctrl
gedit ~/showdesktop.sh

paste this in :

#!/bin/bash desktopStatus=`wmctrl -m | grep mode | cut -d\: -f2`
if [ "$desktopStatus" = " OFF" ]
then
wmctrl -k on
else
wmctrl -k off
fi

Save and go back to command line

chmod +x ~/showdesktop.sh

You can now specify this command to run from a mouse button. Button 9 in my case. Open up compizconfig, go into commands and enter ~/showdesktop.sh in one of the commands then bind your button in the button bindings tab.

OK I’ve done this already, but it’s even easier than I thought. I found this after reinstalling xubuntu and thinking about it for more than a few seconds.

It turns out that all the required libraries are installed by default, so :

  1. Make sure your printer is installed in Linux. It probably is, but if not this isn’t going to be very useful
  2.  

  3. Download the python script from here (copy the text, paste into an editor and save as airprint.py in your home folder
  4.  

  5. Mark the file as executable:
    sudo chmod +x ~/airprint.py
  6.  

  7. Run the python script with a switch to put the result in the right place :
    sudo ./airprint.py  -d /etc/avahi/services/airprint.service
  8.  

  9.  Edit your cupsd.conf:
    sudo nano /etc/cups/cupsd.conf
  10.  

  11.  Add “Serveralias *”  above “<Location />”  (without quotes)
  12.  Share your printer in the printing GUI
  13.  

  14.  Print from your iphone/ipad

See the updated version

In iOS 4 there’s a cool feature which lets you print to a shared printer on your LAN. The only problem is that I don’t use MacOS or Windows, so can’t run the Airprint installer. bah.

Luckily some talented bods have figured out how to make linux play nicely with Airprint, and after a few minutes of light tweaking I can print a picture whilst sat on the toilet. Awesome.

First off, follow this guide up to step 6
Next, generate the XML using the script from this page
Now carry on with the first guide

I also had to add ServerAlias * to /etc/cups/cupsd.conf – anywhere in the file will do. Without that the phone would say it had printed but nothing came out.