Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Asked
Viewed 128 times
1

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  <KP7> {  [  KP_Insert,  KP_Insert  ]  };
    key  <KP8> {  [  KP_Home,    KP_Home    ]  };
    key  <KP9> {  [  KP_Prior,   KP_Prior   ]  };

    key  <KP4> {  [  KP_Delete,  KP_Delete  ]  };
    key  <KP5> {  [  KP_End,     KP_End     ]  };
    key  <KP6> {  [  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  <KP7> {  [  KP_Insert], type[group1] = "ONE_LEVEL" };
    replace key  <KP8> {  [  KP_Home],   type[group1] = "ONE_LEVEL" };
    replace key  <KP9> {  [  KP_Prior],  type[group1] = "ONE_LEVEL" };

    replace key  <KP4> {  [  KP_Delete], type[group1] = "ONE_LEVEL" };
    replace key  <KP5> {  [  KP_End],    type[group1] = "ONE_LEVEL" };
    replace key  <KP6> {  [  KP_Next],   type[group1] = "ONE_LEVEL" };
};

here also setxkbmap doesn't retur any error, but there's no effect. What I'm doing wrong?

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.