Sample Header Ad - 728x90

Remapping keypad keys with xkb

1 vote
0 answers
95 views
TL;DR I have a configuration for remapping keys in xkb, which I think should work. setxkbmap reads it without error, but there's no effect.
I'm trying to remap my numpad keys to navigation keys. I used to use xmodmap with the following configuration:
keycode  79 = Insert NoSymbol Insert
keycode  80 = Home NoSymbol Home
keycode  81 = Prior NoSymbol Prior
keycode  83 = Delete NoSymbol Delete
keycode  84 = End NoSymbol End
keycode  85 = Next NoSymbol Next
But after switching to a new system (Fedora 40) I noticed that it doesn't work. A quick search gave m the reason why: the new systems are using xkb and while I might still use xmodmap, it's config will be overwritten by xkb. After some trying I came up with the following config:
partial keypad_keys xkb_symbols "num_independent" {
    key   {  [  KP_Insert,  KP_Insert  ]  };
    key   {  [  KP_Home,    KP_Home    ]  };
    key   {  [  KP_Prior,   KP_Prior   ]  };

    key   {  [  KP_Delete,  KP_Delete  ]  };
    key   {  [  KP_End,     KP_End     ]  };
    key   {  [  KP_Next,    KP_Next    ]  };
};
Saved it to /usr/share/X11/xkb/symbols/numnav, then added numnav:num_independent = +numnav(num_independent) to /usr/share/X11/xkb/rules/evdev uder ! option = symbols. Also added the following to /usr/share/X11/xkb/rules/evdev.lst under ! option:
numnav               Using NumPad keys as navigation keys
  numnav:num_independent NumPad keys behaving as navigation keys regardless of NumLock status
Finally setxkbmap -v 10 -option 'numnav:num_independent' confirmed that the new config was read without error. Here's the output:
Setting verbose level to 10
WARNING: Running setxkbmap against an Xwayland server
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     us
options:    numnav:num_independent
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+inet(evdev)+numnav(num_independent)
geometry:   pc(pc105)
Sadly, the changes made no effect. So I tried another possibility for /usr/share/X11/xkb/symbols/numnav:
partial keypad_keys xkb_symbols "num_independent" {
    replace key   {  [  KP_Insert], type[group1] = "ONE_LEVEL" };
    replace key   {  [  KP_Home],   type[group1] = "ONE_LEVEL" };
    replace key   {  [  KP_Prior],  type[group1] = "ONE_LEVEL" };

    replace key   {  [  KP_Delete], type[group1] = "ONE_LEVEL" };
    replace key   {  [  KP_End],    type[group1] = "ONE_LEVEL" };
    replace key   {  [  KP_Next],   type[group1] = "ONE_LEVEL" };
};
here also setxkbmap doesn't retur any error, but there's no effect. What I'm doing wrong?
Asked by Peter C (11 rep)
Jul 14, 2024, 02:20 PM