I'm having an issue with Ubuntu. I cannot double-click, as ctrl+click is not working properly. I cannot figure out how to set the keyboard to the correct settings, can anyone give me a step-by-step guide?
I'm having an issue with Ubuntu. I cannot double-click, as ctrl+click is not working properly. I cannot figure out how to set the keyboard to the correct settings, can anyone give me a step-by-step guide?
Have a look here: https://help.ubuntu.com/community/MacBook
-[Discipline] - Macbook Pro 5,3 - Intel Core2Duo 2.66Ghz, 4Gb RAM, Nvidia 9400M + 9600GT, 320Gb HDD, Mac OSX 10.7.1 Lion
-Windows free since May 2007.
Right- and middle mouse-clicks can be simulated on Apple keyboards and touchpads with various combinations of keys and taps. This can present a problem in some drawing applications (like XFig) where you would need an extra hand to terminate a line... What's needed here is a set of single-key right- and middle mouse-click emulations. These might also come in handy in other situations, as they free up a hand (useful when holding a coffee mug) and prevent accidental clicks when merely doing a two-finger scroll on a touchpad.
It is a simple matter to assign right- and middle mouse-clicks to a some little-used keys, like the right-Alt and right-Command keys on any recent Apple keyboard. It doesn't matter much which keyboard you have specified in your Ubuntu setup, I usually pick the PC104 spec for my Apple Aluminum wireless US keyboard. Now, this is what you should do:
1. Install the "xev" package (if it isn't already installed), then in a terminal give the "xev" command. A little window opens with a small square: put the cursor in that square. Then hit the right-Alt and right-Command keys and watch the output for the keycodes, probably 108 and 134, and write them down. Keycodes do change from time-to-time, though, so check them yourself. Then close the little window by clicking on the X; this terminates xev.
2. Make a little script, like /usr/local/bin/keyboard (you need root privileges for that),where you should substitute the keycodes on your keyboard if different from mine. Make this script executable with the commandCode:#!/bin/sh xmodmap -e "keycode 108 = Pointer_Button3" xmodmap -e "keycode 134 = Pointer_Button2" xkbset m3. Make sure that the "xkbset" package is installed, then find where your keyboard settings can be modified and enable control of the mouse with the keyboard, so that the "xkbset m" command in the script will work.Code:sudo chmod a+x /usr/local/bin/keyboard
4. Finally, as user give the command "keyboard", and now those two keys should work as right- and middle mouse-clicks. If this works, then add the command "/usr/local/bin/keyboard" to the startup applications.
N.B. I'm a little vague on where these system settings for keyboard and startup programs are located. That's intentional, as their location has changed several times over the past years. You should look for System settings, or some such...
NN.BB. Usually I add a few more key assignments to the above script, like putting the §/± and `/~ key assignments rightCheck these keycodes with xev as above.Code:xmodmap -e "keycode 94 = section plusminus" xmodmap -e "keycode 49 = grave asciitilde"
These key-assignments don't interfere with the system settings for the keyboard layout. For example, you can still in the layout specify the left-Alt key as the Compose key (for making accented letters on a US-keyboard); and the left-Command key (usually called left-Windows key...) as Third-level chooser to produce a EuroSign.
Have fun with your new key assignments!
Last edited by hajk; February 12th, 2012 at 09:15 PM. Reason: To make it an ever more perfect post...
good post hajk, I think I will post this one in the FAQ.
Glad to be of help.
BTW, the reason I prefer using keys for clicking instead of tapping the touchpad with one or more fingers is a very practical one: just trying to move the cursor (with one finger) or doing a two-finger scroll was forever giving me mouse clicks instead (and driving me mad in the process). I guess I'm heavy-handed when I get absorbed in work... The only touchpad nicety that I allow myself is one-finger vertical scrolling along the right edge of the touchpad.
Thanks hajk for this helpful post
I tried it on Ubuntu 8.10, Macbook Pro Core2Duo with the your script for the right mouse click and it works. Except of one "not found" message I receive starting the script "keyboard" manually:
Although it does work soemthing seems to be not working as supposed?~$ keyboard
/usr/local/bin/keyboard: 3: xkbset: not found
Perhaps you might have a look at it?
Best regards,
tp42
You need the "xkbset" package installed for that. This is (was) mentioned in item 3 a bit as an afterthought, I've now given this requirement a bit more prominence. Thanks for the feedback.
I mapped my right Apple key for right clicking by running the command
xmodmap -e "keycode 134 = Pointer_Button3" & xkbset m
works for me.
However, adding this command to System->Preferences->Startup Applications produces no effect. Is something overwriting the effect of this command at log on, or am I doing something wrong?
The & is a separator for two commands, while you can only give a single command in Startup Programs. So, gather those two commands in a script, make it executable, then call that script in Startup Programs.
Personally, I'm still a fan of using the mac-style CONTROL + Click to get a right-click. If that is what you would like to do, then here is how to go about it:
Hit ALT-F2 and give this command:
It'll prompt you for a password.Code:gksudo gedit /etc/default/mouseemu
Now just set it up like this:
And once you save, log out, and log back in, control-click will handle your right-click issues.Code:#MID_CLICK="-middle 0 68" # F10 with no modifier MID_CLICK="-middle 125 272" # Left Apple Key (LEFTMETA) + click #RIGHT_CLICK="-right 0 87" # F11 with no modifier RIGHT_CLICK="-right 29 272" # Left Ctrl + click #SCROLL="-scroll 56" # Alt key #TYPING_BLOCK="-typing-block 300" # block mouse for 300ms after a keypress
---------------------------------------------------
Linux: Because my business ISN'T "Everybody's Business"
Bookmarks