I have a custom keyboard layout, that I enable using this commands:
setxkbmap -verbose us -variant altgr-intl xmodmap -verbose /home/coub/.myxmodmap
This works just fine, the thing is, that when I attach an external keyboard, the attaching will dismiss my settings and set the default "QWERTY". I would like to keep my settings.
I don't know how to disable this fall back to "QWERTY" on attaching, so at least I've tried to set an
udev rule to enable my settings again. However the environment in
udev doesn't have access to
Xorg environment, so the commands fail.
To workaround this I've written a watcher, that uses
inotifywait to watch a file and then I change this file by writing to it from an
udev rule. This almost works, when the keyboard is plugged, it loads my settings, but the keys with third modifier, that is ALT-gr+KEY gets mapped incorrectly to some weird keys, that I don't have in my setting.
When I change the file (by
echoing "something" > watched_file) from terminal emulator, it just works and my keyboard setting is loaded properly.