this post was submitted on 05 May 2025
17 points (94.7% liked)

Linux

53918 readers
1019 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS
 

I want to change the key mapping of Shift+Backspace to Delete.

Running xmodmap -pke gives me (among other lines):

keycode 22 = BackSpace BackSpace BackSpace BackSpace BackSpace BackSpace

I change this line to

keycode 22 = BackSpace Delete Delete Delete Delete Delete

and save it in the file ~/.Xmodmap and run xmodmap ~/.Xmodmap. Apparently, this worked in part. When I run xev and press Shift+Backspace I get:

KeyPress event, serial 37, synthetic NO, window 0x1200001,
    root 0x300, subw 0x0, time 133664788, (484,630), root:(584,799),
    state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x1200001,
    root 0x300, subw 0x0, time 133665052, (484,630), root:(584,799),
    state 0x1, keycode 22 (keysym 0xffff, Delete), same_screen YES,
    XKeysymToKeycode returns keycode: 119
    XLookupString gives 1 bytes: (7f) ""
    XmbLookupString gives 1 bytes: (7f) ""
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x1200001,
    root 0x300, subw 0x0, time 133665116, (484,630), root:(584,799),
    state 0x1, keycode 22 (keysym 0xffff, Delete), same_screen YES,
    XKeysymToKeycode returns keycode: 119
    XLookupString gives 1 bytes: (7f) ""
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x1200001,
    root 0x300, subw 0x0, time 133665444, (484,630), root:(584,799),
    state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

With other modifier keys (LeftAlt, RightAlt, LeftCtrl) I still get BackSpace.

But xev seems to be the only application that recognizes Delete. In Wayland applications I get only Backspace, no matter what modifier key (Shift, LeftAlt or RightAlt, LeftCtrl) I press. In Firefox (an X application) there is a change. Now, Shift+Backspace does nothing. I suppose this is because Shift+Delete does nothing as well. The KeyPress event of Shift_L seems to block Delete from being obeyed by applications, which is unfortunate when Shift is part of a key combination that maps to Delete. How can I undo this block of Delete? How can I make the key mapping work in Wayland and X applications?

you are viewing a single comment's thread
view the rest of the comments
[–] ccmskw@sh.itjust.works 1 points 1 day ago (1 children)

I read about this method of changing key mappings of your keyboard layout in the /usr/share/X11/xkb/symbols/ directory. I think this is basically what you do. In these files there are only symbols and "partial alphanumeric_keys" defined. I don't see how keys like backspace can be redefined there. But I will look further into it.

[–] mina86@lemmy.wtf 2 points 1 day ago

Yes. I’m just keeping the symbols file in home directory so that I don’t have to edit the system files. To change backspace you’d have something like the following I believe:

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