(Answer) (Category) Linux on PowerPC FAQ-O-Matic : (Category) X Windows :
How can I get three mouse buttons under X?
If typing Option-2 and Option-3 for the middle and right
mouse buttons respectively annoys you (these are the 
defaults, and yes I hate them), you can use xmodmap
to change this.  Edit your startx file to have the 
following line:

serverargs="-nooptionmouse -middlekey 128 -rightkey 130"

Your middle and right mouse buttons will be mapped to
F1 and F2, respectively. Do "man xmodmap" for more details.

-- Dan Caugherty (caffeine1@mindspring.com)
caffeine1@mindspring.com
If you want to use the standard Apple one-button mouse, you can use
Option-2 (hold down Option and type 2 on the keyboard) to emulate the
middle button, and Option-3 to emulate the right button.

Gordon Matzigkeit <gord@gnu.org>
slipcon@cs.jhu.edu, jonh@cs.dartmouth.edu, gord@gnu.org
See also:
(Xref) How do I use all three buttons of my three button mouse in X? (MkLinux)
or
(Xref) How do I use all three buttons of my three button mouse in X? (Linux-pmac)
jonh@cs.dartmouth.edu
In kde, this works for me:

option + click = middle button
control + option + click = right button
jason@roasted.org
after mucking about for quite some time on a strawberry 333 iMac, and _not_ getting three button support using option 1 and option 2, I tried editing startx as suggested. Still no dice. My cat walked across my number pad... and discovered that the buttons were mapped to "clear" and "=". Cats make great sysadmins.
ron@opus1.com
But option-2 and option-3 do not work by default under linuxppc-1999 (R5). See "What happened to option-3 as ..." for info on how to set mouse buttons up under the new versions.
--Mike
gertz@mcs.anl.gov
The option-2 for button 2 and option-3 for button-3 work fine under the new kernel. The problem is that option has been coopted for the mod2 function (ie, ALT). So, unless you care about ALT for some reason, you can fix all this by creating a file named .Xmodmap in your home directory containing the single line:
clear mod2
Then, you can use either
option-2 or left-option click for mouse2 and option-3 or right-option click for mouse3
bmonsen@cisco.com
I tried everything to get Linux r5Q3 on USB imac to see 3 buttons, nothining worked. I bought a UniMouse. www.contourdesign.com and it all works fine if you use the B&W rev2 kernel. However - never hot swap this device it will just about pop your sound system & speakers if you try it. There is a driver .rpm on their web site but my mouse worked fine just out of the box. Drivers are needed to use it on the Mac side.
production@scmp.co.uk
You really want to buy a 3-button mouse. Basically, you just go to the store, buy a mouse, plug it in, and you're done. Here are some caveats and details:
If you've already installed and configured everything, you may need to re-run Xconfigurator, mouseconfig, or another tool, or edit /etc/X11/XF86Config or another file, to turn on multi-button mouse support. Or you could just reinstall, if you're a real newbie.
If your Mac has a PS/2 mouse port (e.g., Motorola StarMax) or USB mouse port (e.g., G4), use it. You can buy mice made for PCs for next to nothing, and they work. (Don't worry if the box says "Windows 95 or better"--your have something _much_ better.) Of course the $5 mice don't always last too long, so you might want to consider either spending $30 for something from a decent brand like Logitech, or buying a couple of mice so you can still work when the first one dies.
With a PS/2 mouse, as long as you have nothing plugged into your ADB chain, the PS/2 mouse shows up as an ADB mouse, and everything is fine.
USB requires kernel support. If you have an older kernel, you'll have to upgrade or patch and recompile.
Old-style PC busmice and serial mice can be run through an PS/2 adapter, if you happen to have them lying around. But a PS/2 adapter costs almost as much as a PS/2 mouse.
If you're ADB-only (most Macs before the iMac) it's a little more expensive, and harder to find. Also, there are some ADB mice (MouseSystems models, for example) that don't follow the Apple extended ADB protocol and will be useless. Everything from Kensington works; I don't know about other brands. I personally love their Thinking Mouse, but even after a few years, the weird button layout sometimes throws me (the "middle" button is on the right, the "right" button is below the "left," and there's a useless extra button).
You may want to look at a wheel mouse instead of a plain-old 3-button mouse. They're even easier to find (and maybe cheaper) nowadays, and you can get the wheel to scroll for you. On the other hand, clicking the roller doesn't feel quite the same as clicking a button.
If you get a "stick" mouse, or other mouse that scrolls in both the X and Y directions, it may not be as useful. My experience is only with one brand (IBM), on a PC running an earlier version of XFree86, but I could never get the horizontal scrolling to work (XF86 doesn't understand more than 5 buttons very well).
andi@payn.net
Well, for those of you in a lab with 8 gazillion iMacs and 'just buying a mouse' isn't an option, just to let you know (since nobody has mentioned it), it really varies on the distribution and keyboard to find where your 3 buttons are located. I know in YellowDog Champion 1.1 it was the Clear and = using a USB keyboard. I hear that under LinuxPPC it's the Option-1 and Option-2, and for YellowDog Champion 1.2, I have yet to find out... so if someone knows, please let me know... otherwise I'll have to join their mailing list again... 8-)
Ron Thompson SQA Engineer Apple Computer, Inc.
rthompson@apple.com
On my lombard PB G3 I use kernel params: adb_buttons=52,58 that gives me "Option_Left" button for context sensetive menus, "Enter-close-to-spacebar" instead of "middle button" to paste the clippboard. Also it keeps my "Ctl-Alt-F1" still working to switch from X-windows to text console.
spanskikh@sectorbase.com
The Yellow Dog Linux manual suggests to add "adb_buttons=1,102,111" to the kernal arguments in the bootX program in order to get 2nd and 3rd buttuns mapped to the F11 and F12. Worked for me.
jason@sbl.salk.edu
You can actually use a PC serial mouse if you happen to have one lying around and the proper serial adapter cable. (I actually wrote a basic driver for doing this under MacOS at one point a few years back.) Anyhow, under Debian Linux for PPC, I have a MouseSystems-compatible 3-button mouse hooked up to the modem port. In XF86Config, the pointer device is "/dev/ttyS0", protocol "MouseSystems". Try "man XF86Config" if your mouse speaks a different protocol.
mypalmike@hotmail.com
I'm running SuSE PPC 7.0 with a 2.2.18-4hpmac kernel (compiled from sources at linuxppc.org) on a Beige G3, and initially had no luck getting 3-button emulation working in X -- none of the usual suggestions worked, not the adb_buttons argument, not option-2, etc. And, interestingly, not even the instructions from the SuSE support database worked, even though they were supposed to apply to SuSE 7.0.

I scoured the net a bit, and discovered that newer kernels -- starting with 2.2.16 (at least in the SuSE tree, since that's the one installed with 7.0) or later -- use a new input layer, which is tied to USB support. To make a long story short, the PPC kernel needs to support USB and HID (details at http://home.munich.netsurf.de/Franz.Sirl/inputppc.html). The reason why the SuSE instructions weren't working for me is that I was trying to be efficient when I first compiled my 2.2.18 kernel: I don't have USB in my machine, and so I had removed support for it when I configured that kernel. So, I re-did my .config to include USB and HID support, recompiled, rebooted, and now my mouse button emulation works. I suspect anyone using a pre-compiled recent kernel have this feature built in, so these instructions should work for you right away (check for the existence of the directory /proc/sys/dev/mac_hid/ -- if it's there, your kernel should have this feature).

The instructions -- from the above URL -- are to enter, as root:

echo "1" > /proc/sys/dev/mac_hid/mouse_button_emulation

This will enable mouse button emulation, which defaults to having the right control key emulating the 2nd mouse button and the right option key emulating the 3rd mouse button. Echoing other values into /proc/sys/dev/mac_hid/mouse_button2_keycode (for the middle mouse button) and /proc/sys/dev/mac_hid/mouse_button3_keycode (for the right mouse button) will change the keys used for button emulation. For a full list of keycodes, see the header file at http://homepages.munich.netsurf.de/Franz.Sirl/input.h -- note that these are not the same as the older adb keycodes (i.e. those used in the adb_buttons kernel argument). The SuSE documentation -- at http://sdb.suse.de/sdb/en/html/poeml_mouse_buttons_emulation.html -- suggests 87 (F11) for the middle button, and 88 (F12) for the right button.

To make the change permanent, put the three 'echo' commands in a script run when your machine boots; in SuSE, they can be put at the end of /sbin/init.d/boot.local .

ozon_m@hotmail.com

I am running linuxppc-haloween (obtained first week of January from my local linux mirror.  I am running kernel 2.2.18-4hpmac which came pre-packaged.  I am running on an iMac (slot loading) with a USB keyboard and one-button hockey puck mouse.

Another way to enter the keycodes ozon_m@hotmail.com mentioned is to add them to the sysctl.conf file as follows:
dev.mac_hid.mouse_button2_keycode=125
dev.mac_hid.mouse_button3_keycode=126
125 and 126 are the keycodes of the buttons that I use; they are the [left-open-apple] and [right-open-apple] buttons on my keyboard.

TO DETERMINE KEYCODES for your favorite keys:
To switch from an X console to a text console on a linuxppc machine, hit [left-control]-[left-alt]-[left-open-apple]-[F1].   This brings you to a text console.  
The command showkey --keycode will tell you the codes that you are typing when you hit a key.  Hitting the [left-open-apple] key brings you back to the X server.  (NOTE: if you re-map the [left-open-apple] key as I did above, then this method will no longer work to get back from the text console.  You'll need to kill the X server to get back to a login prompt.)

You can use this method to find the keycodes of the keys you want to use as button-2 and button-3.

WARNING:  On my machine at least, these keycodes are DIFFERENT than those found using xmodmap.  The numbers from xmodmap will not work.
crsteffe@indiana.edu
This applies to a 2.2.19 kernel and, hopefully, later versions.
The buttons are emulated in the adb driver. There is--if your system is new enough--a directory called /proc/sys/dev/mac_hid which contains control information. On my system it contains five files:
  keyboard_lock_keycodes
  keyboard_sends_linux_keycodes
  mouse_button2_keycode
  mouse_button3_keycode
  mouse_button_emulation
To activate the emulation, add the following line to /etc/sysctl.conf:
  dev.mac_hid.mouse_button_emulation = 1
The key codes are defined in /usr/include/linux/input.h; I believe they can be changed with more lines in /etc/sysctl.conf.
In my Debian "potato" system, the right-hand control key operates as mouse button two and the right-hand option (or alt) key operates as mouse button three.
randolph@panix.com
I made a patch to have ctrl-click perform a right-click with kernel 2.4.19. It's http://geekounet.org/patches/files/linux-2.4.19-ctrl_click.patch . Could be better, but works quite ok.
colin@colino.net
[Append to This Answer]
Previous: (Answer) Can I use a Dvorak keyboard with X Windows?
Next: (Answer) How do I get color-ls to work in xterm?
This document is: http://www.jonh.net/cgi-bin/lppcfom/fom?file=78
[Search] [Appearance]
This is a Faq-O-Matic 2.717d.
Hosted by anduin.org and SourceForge Logo