Friday, September 10, 2010

Right Clicking on a Debian iBook

The mystery of right clicking has been solved. The iBooks only came with one trackpad button (obviously), so to right click and middle click, both essential in the Linux environment, you either need to plug a three button mouse into the USB port or map the functions to the keyboard.

Debian already installs with middle and right click mapped to F11 and F12 respectively, but on the iBook F12 is taken up by the eject key, so........

Time to remap. I'd simply find the keycodes to fn + ctrl and fn + option and map the clicks there instead of F11 and F12, and I'd be on my way. The terminal command showkey conveniently does this for you, except when I do it. Then it gives back Couldnt get a file descriptor referring to the console. Crap. Instead of investigating and finding out what the hell is going on, I was feeling lazy so I just cribbed off what other people on the web did.

So here's the solution: Edit the file /etc/sysctl.conf by adding the following lines (notice there's no "/" before the dev)--

dev/mac_hid/mouse_button_emulation = 1
dev/mac_hid/mouse_button2_keycode = 97
dev/mac_hid/mouse_button3_keycode = 100

then save. This will make fn + ctl and fn + alt your middle and right click keys. Or if you prefer the command and enter key (next to the spacebar) to be middle and right click, replace 97 with 125 and 100 with 96. Desktop users will want f11 and f12, so replace 97 with 87 and 100 with 88 (desktop users only because f12 may conflict with a laptop's eject key).

To initiate changes either restart or run sudo sysctl -p /etc/sysctl.conf

Now I have middle and right click working on the iBook as fn + ctrl and fn + option. I'm starting modestly.

UPDATE: On a new install, I noticed mouseemu conflicts with this, so to fix it I just did a sudo aptitude purge mouseemu. Or if you prefer to use mouseemu to emulate middle and right click, you can stick with that. Also, the showkey command works as showkey --keycodes.


  1. Im having a similar problem on my powerbook g3 lombard, except the f12 button is there, but neither f11 nor f 12 do anything, except that the f11 makes my browser full screen i think (erases the browser border). Any suggestions. Anyway... just thought i'd like my first blog on installing debian...

  2. I wrote a more comprehensive (5 part) guide to installing Debian starting here:

    It covers the right-click stuff and everything else I could think of:)