pf@islington-terrace.csc.ti.COM (Paul Fuqua) (05/04/90)
I occasionally have access to a SparcStation 1 running 4.0.3c and X11R4 patched up to at least fix-9. I'm trying to use xmodmap to make the diamond keys (Meta_L and Meta_R) into Control keys and the Alt key (Alt_L) into a Meta key. [I'm usually a lisp machine user, hence the odd arrangement.] I've tried two sequences in a .xmodmaprc file (see below). Feeding either to xmodmap in my .xinitrc gives me xterms that just beep when I use any of the Control keys, even though xmodmap -pm shows the right keys with the right modifiers. Gnuemacs and xsaber, however, accept them as I intended. If I start up X without xmodmap, then run xmodmap from an xterm, that one xterm will have the keys shuffled as I want, but any xterm created later will just beep. Is there something I'm missing here? How can I do this? Any help appreciated. First .xmodmaprc: remove Mod1 = Meta_L remove Mod1 = Meta_R keysym Alt_L = Meta_L keysym Meta_L = Alt_L add Mod1 = Meta_L add Control = Alt_L add Control = Meta_R Second .xmodmaprc: remove Mod1 = Meta_L remove Mod1 = Meta_R add Control = Meta_L add Control = Meta_R add Mod1 = Alt_L Paul Fuqua pf@csc.ti.com {smu,texsun,cs.utexas.edu,rice}!ti-csl!pf Texas Instruments Computer Science Center PO Box 655474 MS 238, Dallas, Texas 75265
gildea@ALEXANDER.BBN.COM (Stephen Gildea) (05/10/90)
From: pf@islington-terrace.csc.ti.COM (Paul Fuqua) Subject: Using xmodmap to shuffle control and meta keys Date: 3 May 90 19:35:31 GMT I occasionally have access to a SparcStation 1 running 4.0.3c and X11R4 patched up to at least fix-9. I'm trying to use xmodmap to make the diamond keys (Meta_L and Meta_R) into Control keys and the Alt key (Alt_L) into a Meta key. [I'm usually a lisp machine user, hence the odd arrangement.] I've tried two sequences in a .xmodmaprc file (see below). I, too, like the keyboard layout of the MIT Lisp Machines, and have written an xmodmap input files to remap Sun Type 3 and Type 4 keyboards to Lisp Machine style. But first let's look at what's wrong with your attempts. First .xmodmaprc: remove Mod1 = Meta_L remove Mod1 = Meta_R keysym Alt_L = Meta_L xxx keysym Meta_L = Alt_L add Mod1 = Meta_L add Control = Alt_L add Control = Meta_R I've marked the offending line above with "xxx". The line above it redefines the Meta_L keysym, so you can't use it any more to refer to the old key. Second .xmodmaprc: remove Mod1 = Meta_L remove Mod1 = Meta_R add Control = Meta_L add Control = Meta_R add Mod1 = Alt_L Here you've run up against an unfortunate part of the ICCCM. The problem is that X11 does not define any modifier list to be Meta. (Since Meta is used so much, this would seem to be a bug.) Section 6.6 of the ICCCM, "The Modifier Mapping," states, "Clients should determine the meaning of a modifier bit from the keysyms being used to control it." That is, Mod1 is not necessarily Meta. Mod1 is only Meta if there are Meta keys assigned to it. What this means for you is that you have to reassign the Meta_L and Meta_R keysyms to the keys you want to be Meta and then attach the newly-redefined Meta keysyms to the Mod1 list. Now for the xmodmap input file I use. This goes a bit further than you may want to, so look it over and see if there are any parts you want to delete. Since the modifier keys on the Type 4 keyboard are so small physically, I use both of the outside two keys for Meta. That is, CapsLock, Alt_L, Compose, and AltGraph. You may prefer the inside two to be Control, or want to leave the outside pair alone entirely (which has the advantage of not clobbering CapsLock). I move CapsLock to F2. I use the old Control key as Delete, again following the lisp machine style. (Flame: If MIT could do such a nice job of keyboard layout decades ago, how come modern commerical keyboards for engineering workstations still haven't gotten it right?!) I've also been tempted to remap backquote to send Return, but haven't done that yet. This is set up for use on a Type 4 keyboard. Commented out lines should show you how to modify this file for the much nicer layout of the Type 3 keyboard. ! gildea's xmodmap input file for Sun Type-4 keyboard ! Time-stamp: <90/03/23 12:26:52 gildea> ! Use LispM-type Control, Meta, and Delete key locations. By gildea@bbn.com. ! Sun Type-4 keyboard weirdness: ! The MIT R3 server thinks the key labelled "Alt" is Alt_R ! It doesn't know about "Compose" or "Alt Graph" ! The xnews server thinks the key labelled ! "Alt Graph" is Alt_R and "Alt" is Alt_L. "Compose" is Multi_key ! The MIT R4 server is the same as xnews but doesn't know about "Alt Graph". ! first, clear some modifiers. Mod1 means Meta clear Mod1 clear Control clear Lock ! The order here is important; ! can't use "keysym name" after "name" has been reassigned. keysym Control_L = Delete keysym Meta_L = Control_L keysym Meta_R = Control_R ! ! Special keys for Type-4 keyboard keysym Alt_L = Meta_L keysym Multi_key = Meta_R ! MIT R4 server doesn't know keysym for "Alt Graph" key keycode 20 = Alt_R keysym Caps_Lock = Alt_L ! BackSpace is misplaced on Type-4 keyboard. ! Make useless Help key work in Emacs keysym BackSpace = Delete keysym Help = BackSpace ! Special keys for Type-3 keyboard !keysym Caps_Lock = Meta_L !keysym Alt_R = Meta_R ! keysym F2 = Caps_Lock ! now add the modifiers back, but the keys have changed. add Control = Control_L Control_R add Mod1 = Meta_L Meta_R Alt_L Alt_R add Lock = Caps_Lock Enjoy. Let me know if you need help customizing this to your tastes. < Stephen Bolt, Beranek, and Newman, Inc. gildea@bbn.com Cambridge, Massachusetts "I beg of you, M'sieur, watch yourself. Be on guard. This place is full of vultures, vultures everywhere, everywhere."