[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mapping cmd to alt in X with linux keycodes



On Wed, Oct 10, 2001 at 08:21:45PM -0500, Branden Robinson wrote:
>On Wed, Oct 10, 2001 at 04:05:23PM -0800, Ethan Benson wrote:
>> the trouble is nobody can agree whether `command == meta' is `wrong'
>> or not.  
>> 
>> given the option key is the one with `alt' engraved on it one would
>> presume it should be treated as alt, regardless of the fact that apple
>> put it in the wrong place.
>> 
>> one could probably say the same for Sun keyboards and thier
>> caps-lock/control key placement.
>
>These are easily taken care of with little option files that you can
>manipulate with XKbOption.  Like "ctrl:nocaps" on the PC keyboard.

Patch attached which works on my powerbook.  All that's been done is to
enable the command key as meta (previously produced nothing) and then
provide an option to swap.

Works well for me, but may need some attention if there are apple
keyboards with right option or command keys that send distinguishable
keycodes.

My keyboard section looks like this:

    Driver "keyboard"
    Option "CoreKeyboard"
    Option "XkbRules"     "xfree86"
    Option "XkbModel"     "macintosh"
    Option "XkbLayout"    "us"
    Option "XkbOptions"   "alt:swapmeta"

Regards,
-- 
Brendan O'Dea                                        bod@compusol.com.au
Compusol Pty. Limited                  (NSW, Australia)  +61 2 9810 3633

diff -Naur /etc/X11/xkb.orig/rules/xfree86 /etc/X11/xkb/rules/xfree86
--- /etc/X11/xkb.orig/rules/xfree86	Sat Aug  4 10:46:48 2001
+++ /etc/X11/xkb/rules/xfree86	Thu Nov  8 22:36:54 2001
@@ -148,6 +148,7 @@
   ctrl:swapcaps		=	+ctrl(swapcaps)
   ctrl:ctrl_ac		=	+ctrl(ctrl_ac)
   ctrl:ctrl_aa		=	+ctrl(ctrl_aa)
+  alt:swapmeta		=	+alt(swapmeta)
 
 ! option		=	compat
   grp_led:num		=	+leds(num)
diff -Naur /etc/X11/xkb.orig/symbols/alt /etc/X11/xkb/symbols/alt
--- /etc/X11/xkb.orig/symbols/alt	Thu Jan  1 10:00:00 1970
+++ /etc/X11/xkb/symbols/alt	Thu Nov  8 22:29:58 2001
@@ -0,0 +1,6 @@
+// Swap the left alt and "windows" keys
+partial modifier_keys 
+xkb_symbols "swapmeta" {
+    key <LALT>	{  symbols[Group1] = [ Meta_L ] };
+    key <LWIN>	{  symbols[Group1] = [ Alt_L ] };
+};
diff -Naur /etc/X11/xkb.orig/symbols/macintosh/us /etc/X11/xkb/symbols/macintosh/us
--- /etc/X11/xkb.orig/symbols/macintosh/us	Sat Aug  4 10:46:51 2001
+++ /etc/X11/xkb/symbols/macintosh/us	Thu Nov  8 22:31:48 2001
@@ -152,7 +152,7 @@
     // End "Keypad" section
 
     // Begin modifier mappings
-//    key <LMTA> {	[  Meta_L	 	]	};
+    key <LWIN> {	[  Meta_L	 	]	};
     key <LFSH> {	[  Shift_L		]	};
     key <LCTL> {	[  Control_L		]	};
     key <LALT> {	[  Alt_L	 	]	};
@@ -171,7 +171,7 @@
 //    modifier_map Mod1   { Alt_L, Alt_R };
     modifier_map Mod2   { Num_Lock };
     modifier_map Mod1   { Alt_L, Alt_R };
-//    modifier_map Mod4   { Meta_L, Meta_R };
+    modifier_map Mod4   { Meta_L, Meta_R };
     modifier_map Mod3   { Mode_switch };
     // end modifier mappings
 



Reply to: