11/06/2009
Handling right clicks on a macbook running Linux
I’ve finally settled down to a solution that I am happy with. I used to have the following options inside my Xorg.conf:
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
[...snip...]
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "VertTwoFingerScroll" "1"
Option "HorizTwoFingerScroll" "1"
[...snip...]
This works like this:
i) a single tap is a left click
ii) a two-finger tap is a right click
iii) a three-finger tap is a middle click
and you could scroll horizontally and vertically using two fingers on the touchpad, like Mac OS X.
The problem with this setup is that I used to have a lot of accidental double tappings while scrolling with two fingers horizontally or vertically. This of course produced unwanted right clicks.
I wanted a solution that I could get right click in somehow like Mac OS X does it, using ctrl+tap/ctrl+click. I found a solution that emulated ctrl+click as a right click but then many applications started misbehaving. Firefox for example uses ctrl+click on Linux to open a link on a new tab, when I used ctrl+click as a right click, Firefox stopped opening the links. So I went to plan B.
CMD key(apple key)-click as a right click.
To achieve that:
a) install xvkbd.
Debian: apt-get install xvkbd
Gentoo: emerge xvkbd
b) install xbindkeys.
Debian: apt-get install xbindkeys
Gentoo: emerge xbindkeys
c) create the default .xbindkeysrc file: xbindkeys –defaults > ~/.xbindkeysrc
d) edit it and put the following inside: "xvkbd -text '\m3'"
mod4 + b:1 (mouse)
e) edit xorg.conf and set this: Option "TapButton2" "0"
This effectively disables double tapping as a right click.
f) restart X
g) open a terminal and start xbindkeys from it: $ xbindkeys -n -v
Now press CMD key and tap the touchpad or click the touchpad button. You should be greeted with a fresh right click!
If all went well put xbindkeys in your DE’s autostart.
The following works flawlessly on XFCE/LXDE. CMD-click or CMD-tap opens XFCE’s menu or LXDE’s desktop menu.
On fluxbox though there is still a problem. It’s very common for fluxbox key config to look something like the following:
OnDesktop Mouse1 :hideMenus
OnDesktop Mouse2 :workspaceMenu
OnDesktop Mouse3 :rootMenu
OnDesktop Mouse4 :nextWorkspace
OnDesktop Mouse5 :prevWorkspace
So to open the RootMenu, which is the basic menu with the applications shortcuts for fluxbox, one needs to actually right click on the Desktop. That worked with TabButton2=3 but it does not work right now. To get around that problem I binded the key left to (1/!) which is normally the (±/§) key on Macs to the Menu key using xmodmap.
$ cat .xmodmap
keycode 94 = Menu
I never used that key anyway…
I’ve now got my precious right click back without accidental miss-clicks. yihaa!
References: FreeBSD on an Apple MacBook
Filed by kargig at 22:29 under Gentoo,Linux
Tags: accidental, click, ctrl-click, ctrl+tap, debian, fluxbox, Gentoo, Linux, lxde, macbook, right-click, synaptic, toucpad, xfce
7 Comments | 34,270 views
[…] post: Handling right clicks on a macbook running Linux | Into.the.Void. Share and […]
[…] …Read More […]
Υπαρχουν επισης επιλογες που καθοριζεις ποση πιεση θεωρειται tap, και ποση click.
Οποτε μετα αντιστοιχα μπορεις να κανεις Option “ClickFinger1” “…” κλπ, και να καταληξεις με αμετρητα gestures/shortcuts. Βολικη επισης ειναι η επιλογη ποσα ms θελει για να καταλαβει tap.
Σου δινω τα δικα μου:
Option “FingerLow” “25”
Option “FingerHigh” “30”
Option “MaxTapTime” “180”
Option “MaxTapMove” “220”
Ρυθμισμενο ωστε να καταλαβαινει σχετικα ευκολα τα taps, γιατι τα χρησιμοποιω συνεχεια (σαν middle button).
Δες και το syndaemon. Απενεργοποιει το touchpad οταν γραφεις για να μην το ακουμπας καταλαθος. 🙂
Προφανώς και χρησιμοποιώ τα παραπάνω που λες…απλά το post δεν ήταν περί synaptic αλλά ειδικά για το “right click” σε macbook 🙂
Thanks anyway
[…] site admin wrote an interesting post today onHandling right clicks on a <b>macbook</b> running Linux | Into.the.Void.Here’s a quick excerpt […]
It looks so promising and yet it does not work for me 🙁 When I tested it in XFCE I got:
Button press !
e.xbutton.button=1
e.xbutton.state=64
“xvkbd -text ‘\m3′”
m:0x40 + b:1 (mouse)
got screen 0 for window 15d
Start program with fork+exec call
xvkbd: Mode_switch not available as a modifier
xvkbd: although ISO_Level3_Shift is used instead, AltGr may not work correctly
Button press !
e.xbutton.button=3
e.xbutton.state=320
Button release !
e.xbutton.button=3
e.xbutton.state=1344
Button release !
e.xbutton.button=1
e.xbutton.state=320
When I tried to write explicitly Super_R (xbindkeys claims it recognizes such symbols) it treated is as code 0, and in result my LMB clicking was treated as RMB clicking.
openSUSE 11.2 if that matters.
Macias: I was having this problem as well. It seemed like the event was registering but it would not run the command. I prepend ‘sleep .05 &&’ to the command so it will wait for the initiating command (and possibly any other mouse event consumers) to complete.
I already posted my solution on superuser:
http://superuser.com/questions/217615/how-to-right-click-using-the-keyboard-from-ubuntu-on-a-mac/695472#695472
Looks like a long time waiting… 🙂