[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in
Re: Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs)
Sun, 27 Aug 2017 22:23:12 +0100
ozhan fenerci <address@hidden> writes:
> I am using international keyboard and extensively use AltGr key. There are
> many unused keys with AltGr so I would like to map " AltGr+ t= Crtl+x " ( I
> don't want to remap AltGr to Crtl; I just want to use this specific
> I know that AltGr is not a modifier key. I am thinking to modify xkb file
> to achieve it. Any advice?
Warning: nasty hack follows...
On X11, AltGr *is* a modifier key (it's "ISO_Level3_Shift" on my
system) and the following won't work if that's not the case for you.
You can use xev to check.
1. Pick a key symbol that you know is not used by your keyboard. Here I
will use XF86Game -- I have no "game" key so I am not losing anything by
2. Save your xmodmap file so you have a chance of restoring it (without an
X11 restart) if all goes wrong:
xmodmap -pke >~/xmodmap-saved
You'd restore the original mapping with
3. Next, use xmodmap to make AltGr+t generate XF86Game:
xmodmap -e 'keycode 28 = t T t T XF86Game'
To make this permanent, put that line in your ~/.Xmodmap file.
The symbols that follow the = sign give the key symbols generated for
keycode 28 (t) both "plain" and with various modifier keys. I find the
details of this confusing, so I just remember that, for my setup at
least, the the fith one is the symbol you get when "AltGr" is down the
sixth when AltGr+shift are down).
There are many more states than this and I can't remember them all.
For example, before doing this
$ xmodmap -pke | grep ' 28 '
keycode 28 = t T t T tslash Tslash tslash Tslash t T tslash Tslash t T
4. Finally, you bind X86Game in Emacs to do whatever you like.
This can fail in lots of ways. You can have different modifier keys set
up. Your system might not load .Xmodmap in login (technically during X
initialisation) and so on.
|[Prev in Thread]
||[Next in Thread]|
- Re: Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs),
Ben Bacarisse <=