[comp.windows.x] making Caps Lock be Meta

ridge@eng.sun.COM (Ridge McGhee) (09/27/90)

You need to be careful about switching keysyms that are currently
in the modifier map (since the modifier map stores keycodes).
Here's a method for achieving the desired result (original message
containing the problem statement is appended to this message):

-----------------------------cut here ----------------------------
! File: switchkeys
!
! Goal: Exchange semantics of Caps_Lock with Meta_L
!       Exchange semantics of Control with Alt_L
!
! Usage: xmodmap switchkeys
!
! Notes: Alternate invocations of switchkeys will switch and unswitch keys
!        An implicit assumption is that mod1 is used for Meta_L and Meta_R
!

! clear any modifier map entries involving Caps_Lock, Meta_L, Control, Alt_L
clear lock
clear control
clear mod1

! exchange semantics
keysym Caps_Lock = Meta_L
keysym Meta_L = Caps_Lock
keysym Control_L = Alt_L
keysym Alt_L = Control_L

! restore modifier map
add lock = Caps_Lock
add control = Control_L
add mod1 = Meta_L Meta_R
-----------------------------cut here ---------------------------

> From: lakin@csli.Stanford.EDU (Fred Lakin)
> Newsgroups: comp.windows.x
> Subject: making Caps Lock be Meta under 4.1 with openwindows2.0 on SS1+
> Message-ID: <15304@csli.Stanford.EDU>
> Date: 12 Sep 90 22:04:50 GMT
> Sender: lakin@csli.Stanford.EDU (Fred Lakin)
> Organization: Center for the Study of Language and Information, Stanford U.
> Lines: 60
> 
> [I posted this to sun-spots; repeat to this list altho I'm not sure if
>  Xopen questions really go here, but ... I havent tried this under
>  the generic X from MIT but I may go to that if no other solutions
>  present themselves]
> 
> I am really stuck on this one. My application interface
> needs meta behavior from Caps Lock, everything was fine
> until the synergy of 2.0 AND 4.1
> 
> Here are the two .xmodmaprc files i have tried. Both produce
> the desired result under openwindows1.0 and OS 4.1. The
> desired result is that the left Alt key be Control and
> the Caps Lock key be Meta. 
> 
> Both versions fail under openwindows2.0 and OS 4.1.
> The Alt still does Control, but (bizarrly) the Caps Lock
> key becomes a "Meta Lock" key (or toggle), turning on and
> off metaization of subsequent chars. What I want of
> course is for the Caps Lock key to become a "Meta Shift"
> key, metaizing chars only when held down (just as Control
> controlizes chars only when held down).
> 
> tnx, f
> 
> PS i think that the cleaner
> 	keysym Caps_Lock = Meta_L
> can now be used under 2.0 instead of
> 	keycode 126 = Meta_L
> but it doesnt seems to make any difference ....
> 
> 
> ;;******  .xmodmaprc i use for 1.0, doesnt do meta right for 2.0
> 
> clear mod1
> 
> keysym Alt_L = Alt_L Control_L
> add Control = Alt_L
> 
> keycode 126 = Meta_L
> clear Lock
> add mod1 = Meta_L
> add Lock = Caps_Lock
> 
> 
> 
> ;;*****  alternate .xmodmaprc with same problem as one above for 2.0
> 
> 
> ! Goal : Alt_L generates control
> ! keycode 26 is Alt_L
> keycode 26 = Control_L
> add control = Control_L
> 
> ! Goal : Caps_Lock generates meta
> ! keycode 126 is Meta_L
> clear mod1
> clear lock
> keycode 126 = Meta_L
> add mod1 = Meta_L
> add lock = Caps_Lock
>