all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ben Bacarisse <ben.usenet@bsb.me.uk>
To: help-gnu-emacs@gnu.org
Subject: Re: Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs)
Date: Sun, 27 Aug 2017 22:23:12 +0100	[thread overview]
Message-ID: <87bmn0yabj.fsf@bsb.me.uk> (raw)
In-Reply-To: mailman.13896.1503852696.21957.help-gnu-emacs@gnu.org

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.


       reply	other threads:[~2017-08-27 21:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.13896.1503852696.21957.help-gnu-emacs@gnu.org>
2017-08-27 21:23 ` Ben Bacarisse [this message]
2017-08-27 22:11 ` Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs) Javier
2017-08-27 16:14 ozhan fenerci

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bmn0yabj.fsf@bsb.me.uk \
    --to=ben.usenet@bsb.me.uk \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.