* Re: Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs)
[not found] <mailman.13896.1503852696.21957.help-gnu-emacs@gnu.org>
@ 2017-08-27 21:23 ` Ben Bacarisse
2017-08-27 22:11 ` Javier
1 sibling, 0 replies; 3+ messages in thread
From: Ben Bacarisse @ 2017-08-27 21:23 UTC (permalink / raw)
To: help-gnu-emacs
ozhan fenerci <fenerci.ozhan@gmail.com> 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
> instance.)
>
> 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
doing this.
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
xmodmap ~/xmodmap-saved
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 tslash Tslash
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.
--
Ben.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs)
[not found] <mailman.13896.1503852696.21957.help-gnu-emacs@gnu.org>
2017-08-27 21:23 ` Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs) Ben Bacarisse
@ 2017-08-27 22:11 ` Javier
1 sibling, 0 replies; 3+ messages in thread
From: Javier @ 2017-08-27 22:11 UTC (permalink / raw)
To: help-gnu-emacs
> 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
You can remap rightAlt to Hyper or super.
xmodmap -e "keycode 108 = Hyper_L" ; xmodmap -e "add mod4 = Hyper_L"
In my keyboard right alt is keycode 108, but that depends on your keyboard layout.
You can look at keysymdef.h for the keynames.
#define XK_Super_L 0xffeb /* Left super */
#define XK_Super_R 0xffec /* Right super */
#define XK_Hyper_L 0xffed /* Left hyper */
#define XK_Hyper_R 0xffee /* Right hyper */
Hyper and Super modifiers will be seen inside emacs. Use C-h l (view lossage)
If it is mapped ok, pressing RighAlt-a you should see
H-a C-h l
Your window manager might be catching the Hyper-a combination before it arrives to emacs.
If so, use super instead of hyper.
Once this works you can customize RightAlt-a in elisp as
(global-set-key (kbd "H-a") 'function)
or (kbd "s-b") for super.
Note that you map it to a function. I don't think you can remap it to C-x
The problem with all this is that applications outside emacs will not see
AltGr anymore.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs)
@ 2017-08-27 16:14 ozhan fenerci
0 siblings, 0 replies; 3+ messages in thread
From: ozhan fenerci @ 2017-08-27 16:14 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
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
instance.)
I know that AltGr is not a modifier key. I am thinking to modify xkb file
to achieve it. Any advice?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-27 22:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.13896.1503852696.21957.help-gnu-emacs@gnu.org>
2017-08-27 21:23 ` Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs) Ben Bacarisse
2017-08-27 22:11 ` Javier
2017-08-27 16:14 ozhan fenerci
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).