4

I use Xmodmap to remap some of my keys. I want to use Xkbmap to have a keyboard shortcut to switch keyboard layouts. When I run setxkbmap us, my keyboard layout changes but my Xmodmap changes get lost. I have to reload the file with xmodmap .Xmodmap.

uname -a:

Linux Hermes 4.8.6-1-ARCH #1 SMP PREEMPT Mon Oct 31 18:51:30 CET 2016 x86_64 GNU/Linux 

pacman -Q | grep xmodmap:

xorg-xmodmap 1.0.9-1 

pacman -Q | grep xkbmap:

xorg-setxkbmap 1.3.1-1 

1 Answer 1

1

xmodmap and setxkbmap are conflicting utilities. Calling xmodmap will reset changes made by setxkbmap and vice versa. You have to pick one of them to do your keyboard configuration with. And also figure out if your system is using one or the other.

You may encounter issues if for example you use xmodmap in your .xsession or similar and after the session file is parsed your DE calls setxkbmap through some script.

1
  • setxkbmap usually overrides everything, while xmodmap mdoifies the existing keymap (overriding only what is specified). so it can be useful to first run setxkbmap and then xmodmap, e.g. if one is more comfortable with xmodmap syntax as opposed to the almost undocumented xkb syntax. Commented Jul 31, 2023 at 17:50

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.