2

I'm on Ubuntu 18.04 LTS

My keyboard is missing the w key. I used

remove Lock = Caps_Lock
keysym Caps_Lock = w W

With xmodmap

how to remap Caps_Lock to w key in Wayland?

PRATAP
  • 22,460

1 Answers1

1

there is a good guide here.. https://brokkr.net/2019/01/11/customize-your-keyboard-layout-and-have-it-work-under-wayland/

Tested in vanilla GNOME 3.38.1 Wayland.

Result: The remapping works form boot,login screen,etc. not like xmodmap which is once the user logs in. Also in the console the remap is effective.

As the above link/guide explains I have followed it. the steps are below.

If any of the package is not installed while running the commands, install them.

sudo evtest

[admin@ADMIN ~]$ sudo evtest
[sudo] password for admin: 
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:  Power Button
/dev/input/event1:  Lid Switch
/dev/input/event2:  Power Button
/dev/input/event3:  AT Translated Set 2 keyboard
/dev/input/event4:  Toshiba input device
/dev/input/event5:  PC Speaker
/dev/input/event6:  Compx 2.4G Receiver
/dev/input/event7:  Compx 2.4G Receiver
/dev/input/event8:  Compx 2.4G Receiver System Control
/dev/input/event9:  Compx 2.4G Receiver Consumer Control
/dev/input/event10: ETPS/2 Elantech Touchpad
/dev/input/event11: Video Bus
/dev/input/event12: Video Bus
/dev/input/event13: HDA Intel PCH Mic
/dev/input/event14: HDA Intel PCH Headphone
/dev/input/event15: HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event16: HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event17: HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event18: HDA Intel PCH HDMI/DP,pcm=9
/dev/input/event19: HDA Intel PCH HDMI/DP,pcm=10
Select the device event number [0-19]:
  1. I Choose 6 as it is my wireless keyboard.

Then press Caps_Lock key, some of the output

type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039

note down the value 70039

Create a text file /etc/udev/hwdb.d/10-my-modifiers.hwdb with below content

evdev:input:b0003*
 KEYBOARD_KEY_70039=w  # bind capslock to w 

then run below commands

sudo systemd-hwdb update
sudo udevadm trigger

Instantly the Caps_Lock key changed to w, I can type W with shift key. It took some time to understand this line evdev:input:b0003* in the text file but document suggests 0003 works just fine.

PRATAP
  • 22,460