Re: Binding the Windows-Key to Alt in X11
Torsten Landschoff <t.landschoff@gmx.net> writes:
> On Fri, Nov 27, 1998 at 02:44:52PM -0600, Rob Browning wrote:
>
> > Actually, I was kind of surprised that I was able to get X configured
> > to support Alt, Meta, and Hyper. The "Windows" key is Alt, the Alt
> > key is Meta (easier to reach), and the "Menu" key is Hyper.
>
> Would you mind to tell us how you did this? ;-)
Dirk asked about this too. In case others are interested, here's how
I did it:
My /etc/X11/XF86Config contains this as the keyboard config:
Section "Keyboard"
Protocol "Standard"
AutoRepeat 500 30
LeftAlt Meta
RightAlt Meta
ScrollLock Compose
RightCtl Control
XLeds 1 2 3
XkbKeycodes "xfree86"
XkbTypes "default"
XkbCompat "default"
XkbSymbols "us(pc101)"
XkbGeometry "pc"
XkbRules "xfree86"
XkbModel "pc104"
XkbLayout "us"
XkbOptions "ctrl:nocaps"
EndSection
And I put this in my ~/.xsession -> ~/.xinitrc:
# Can't remember why I have this bit here. I think it may give me a
# Control_L as separate from a Control_R...
xmodmap -e "remove Lock = Caps_Lock" \
-e "keysym Caps_Lock = Control_L" \
-e "add Control = Control_L"
# Swap Alt to be Meta and vice/versa
# Make the "Menu" key be Hyper_L
xmodmap \
-e "keycode 64 = Meta_L" \
-e "keycode 113 = Meta_R" \
-e "keycode 115 = Alt_L" \
-e "keycode 116 = Alt_R" \
-e "keycode 117 = Hyper_L" \
-e "clear mod1" \
-e "clear mod3" \
-e "clear mod4" \
-e "add mod1 = Alt_L Alt_R" \
-e "add mod3 = Meta_L Meta_R" \
-e "add mod4 = Hyper_L"
If this doesn't quite work for you, then check with xkeycaps (select
the "PC:104 key:Linux/XFree86; US" layout) to see what the right
keycodes are for your machine.
If you're running WindowMaker, it can cause things to be a little
confusing because it binds some of the Alt key combinations to do
things, so Emacs will never see them.
This setup should get you so that you can (in emacs) do a
"M-x load-library iso-transl"
and then use Alt-L to make poundsigns to your heart's content (note
that with these settings, Alt is the "windows" key and the Alt key is
really Meta.
Now you should also be able to bind Ctrl, Alt, Meta, and Hyper
combinations in emacs to do whatever you like...
For example
(global-set-key [?\H-\M-p] 'goto-line)
will make Hyper-Meta-p run goto-line...
--
Rob Browning <rlb@cs.utexas.edu> PGP=E80E0D04F521A094 532B97F5D64E3930
Reply to: