Xmodmap reset on keyboard reconnect (issue)
Holger Sebert
holger.sebert at ruhr-uni-bochum.de
Sun Jan 19 20:53:57 UTC 2025
On 1/18/25 01:21, Tyler Mayes wrote:
> I use a split keyboard (dacyl manuform) that utilizes qmk. One of the keys on the thumbcluster is set to "menu" or "app". I use xmodmap to map this to hyper for use in emacs, as well as enabling F13-F24.
>
> Everything works splendidly barring one small issue. Due to the custom nature of the keyboard I use a magnetic usb-c to enable me to disconnect my keyboard and take it to work or other places where I will need it.
>
> Upon reconnect xmodmap resets to defaults. This wouldn't be as much of an issue if I shutdown my pc at all times but I leave it on for file syncing and remote access.
>
> It's rather tedious to re-run my bash script every time I reconnect. What would be the best way to prevent reconnecting keyboards to set to system defaults? Or alternatively what is the process to redefine the defaults to my use case?
>
> I've tried searching this up online but hyper seems to be a pretty infrequently used feature. I tried looking into /usr/share/x11/xkb/rules/xorg.lst but it seems the xkboptions value might not be freeform but requires preset options.
>
> Best,
> Tyler
Have a look at the 'inputplug' program:
https://github.com/andrewshadura/inputplug
It can run a script automatically when the keyboard is re-connected. Here is
how I use it in my ~/.xinitrc:
…
# Ensure polish accents are re-enabled when keyboard is re-plugged
inputplug --command ~/.local/bin/xmodmap-polish.sh
…
Best,
Holger
More information about the xorg
mailing list