13

I've faced some issues after remapping keyboard with xmodmap: settings get reset randomly after 2-20 minutes after applying. Googled it but no help: something resets them, but all mentions apply to xfce, while I'm under usual 14.04 Ubuntu with unity.

I saw phrases like 'use xkb, forget xmodmap', but still have no idea how to do that. It's either classified or very complicated, because amount of info on that is significantly smaller than for xmodmap way.

Here's my list of customisations:

xmodmap -e "keycode 84 = Down"
xmodmap -e "keycode 79 = Home"
xmodmap -e "keycode 80 = Up"
xmodmap -e "keycode 83 = Left"
xmodmap -e "keycode 85 = Right"
xmodmap -e "keycode 87 = End"
xmodmap -e "keycode 90 = Insert"
xmodmap -e "keycode 91 = Delete"
xmodmap -e "keycode 89 = Next"
xmodmap -e "keycode 81 = Prior"

where keycodes are corresponding keys on numpad, with numlock = off (basically, I'm replacing KP_Del with Delete, KP_Home with Home etc - don't ask why))

Can someone help to find a way to do that using xkb - at least one of the lines? And where to find the "names" of keys for other so I could do the rest by example?

3
  • 5
    Yep. Had exactly the same problem. See here: rlog.rgtti.com/2014/05/01/… and askubuntu.com/questions/422650/… . If you are able to find how to use xkb without rewriting system files, write an answer here... you will be reward by zillions of upvotes.
    – Rmano
    Jun 15, 2014 at 23:01
  • Wow - finally a xkb remap guide that makes things clearer... But I can't see a thing about remapping Home's, Delete's and Up-&Down-arows. It's always about some greek or spanish letters. So far I went the other way - trying to stop system from overriding my Xmodmap settings (recipe #3 from here: programmingiroiro.blogspot.com/2013/03/… ) Jun 16, 2014 at 7:25
  • 1
    Bad idea - no layout switching available after that ( Jun 16, 2014 at 7:37

1 Answer 1

4

You can follow the general idea seen in my answer on a similar problem; if you still want layout switching (although still quite broken) you should define a new layout or variant.

Notice that the template to copy and modify for the editing an keypad is a bit difficult to find. In my keyboard, for example, the geometry is "pc105"; this is defined in /usr/share/X11/xkb/symbols/pc. If you look into it, it include:

[...]
key <SPCE> {        [        space          ]       };

include "srvr_ctrl(fkey2vt)"
include "pc(editing)"
include "keypad(x11)"

key <BKSP> {        [ BackSpace, BackSpace  ]       };
[...]

The keypad is defined in the file /usr/share/X11/xkb/symbols/keypad

[...] 
default  partial hidden keypad_keys
xkb_symbols "x11" {
   include "keypad(operators)"

   key  <KP7> {        [  KP_Home,     KP_7    ]       };
   key  <KP8> {        [  KP_Up,       KP_8    ]       };
[...]

For the name of the key symbols (keysims), the best place to look is into the file /usr/include/X11/keysymdef.h; you may need to have the development packages installed to have it (or install it by instaling x11proto-core-dev):

[...]
/* Cursor control & motion */

#define XK_Home                          0xff50
#define XK_Left                          0xff51  /* Move left, left arrow */
#define XK_Up                            0xff52  /* Move up, up arrow */
[...]

the keysym name is the one you have once removed the "XK_" string.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .