On 14.09.17 18:48, Zenaan Harkness wrote:
> On Thu, Sep 14, 2017 at 06:35:16PM +1000, Zenaan Harkness wrote:
> > So I've mapped the function (mathematical) symbol to Level3-Shift + `
> > (backtick) - created a custom keyboard layout in
> > /usr/share/X11/xkb/symbols/...
> 
> Further, I just copied the "us" file, gave it a custom name, and
> modified the first "key <TLDE> ..." line to read as follows:
> 
>   key <TLDE> { [ grave, asciitilde, function, U266E ] };
> 
> and also added the following line to the bottom of that first section
> in that file:
> 
>   include "level3(lwin_switch)"
> 
> 
> Additionally ("of course") I added a "layout" entry to the file:
> /usr/share/X11/xkb/rules/base/evdev.xml (or "base.xml" - they look
> the same, dunno what's the diff sorry);
> 
> edited:
>  /etc/default/keyboard
>     XKBLAYOUT="mycustomlayoutfilename"
>     XKBVARIANT="basic" # needed ??
>     XKBOPTIONS="lv3:lwin_switch,terminate:ctrl_alt_bksp"
> 
> ran:
>  sudo setupcon
>  sudo dpkg-reconfigure xkb-data keyboard-configuration
> 
> double-checked /etc/default/keyboard and re-ran setupcon,
> 
> and finally rebooted.
> 
> Nothing to it (at least not after you've tried many combinations,
> searched and read a lot, and rebooted more times than my second
> memory cell is capable of remembering :)

All of that looks rather complicated, compared to just using xmodmap.
As an example, I change the CapsLock key to Escape, especially on
laptops, where Escape is tiny as well as more distant than CapsLock.
For permanence, all I do is add the lines:

keycode 0x42 =  Escape
clear Lock

to ~/.Xmodmap , but for a once-off, it can be done with xmodmap
directly:

 $ xmodmap -e 'clear Lock'
 $ xmodmap -e 'keycode 0x42 = Escape'

What is the keycode for the key you want to remap? Run xev, move the
cursor into its focus, and hit the key. Buried in 3 or 4 lines of
verbose output, there's the word "keycode" followed by the number you're
looking for. (Don't move the mouse while checking keys, as there's a
barrage of output, then. ;)

There's also "keysym" followed by a hex value and the key name. 
So we could use the keysym value, instead of keysym name, to make the
numeric pad '.' provide the European decimal comma:

 $ xmodmap -e 'keycode 91 = 0x2c'    # Change numeric pad '.' to ','

or vice versa:

 $ xmodmap -e 'keycode 91 = 0x2e'    # Change numeric pad ',' to '.'

ISTM to be a lot simpler, and has worked here for many a year.

There's an example of swapping keys in "man xmodmap".

Erik

Reply via email to