7

In Ubuntu 12.10 my .Xmodmap settings get lost (reset) after I plug/unplug my wireless keyboard/mouse combo. Do you know how to prevent or override this behavior?

2 Answers2

4

It took a while to figure out, but I have an answer for this. This actually happens on all Ubuntu versions that I checked and I'm using this fix on 12.04 right now.

I have found that these mappings are not reset if you have all of your xmodmap mappings in a file that is called ~/.Xmodmap.

I had called my file .xmodmaprc and had exactly the behavior that you experience. After changing to the new file name, this annoying behavior went away. My guess is that Ubuntu reads mappings from this file whenever there is a new keyboard added to the system.

Cristian Ciupitu
  • 165
  • 1
  • 16
user153371
  • 41
  • 3
  • 2
    In a Lubuntu 14.04.5 live USB, none of these files are read after login. It won't even work by creating a ~/.initrc file including the xmodmap ~/.xmodmaprc command. Why is it so? – nightcod3r Oct 14 '16 at 02:35
  • May be this is the answer: http://askubuntu.com/questions/325272/permanent-xmodmap-in-ubuntu-13-04?rq=1 – nightcod3r Oct 14 '16 at 02:49
0

I'm not sure if this is a bug or a "feature" which I will explain why this could be a feature later on, But here's what I experienced on my laptop:

  • Upon connecting and disconnecting my wireless keyboard USB dongle, xmodmap resets.
  • But after Connecting USB dognle and applying xmodmap bindings, restarting the OS, xmodmap bindings are intact and disconnecting the dongle does not reset xmodmap.

So why this could be a feature? two keyboards means different layouts, so my wireless keyboard's layout is different than my laptop's keyboard of course. I do not want the same bindings I use on my laptop's keyboard on my wireless full sized keyboard, so whenever I plug in my keyboard, xmodmap resets to default.

Do you want the same bindings on your other keyboard? feel free to do xmodmap ~/.Xmodmap in Terminal every time xmodmap resets.

But if you want to have different bindings, keep your bindings for your other keyboard in a new file like ~/.Xmodmap2 and each time you want to use your second keyboard, after you connect it and xmodmap resets, just do xmodmap ~/.Xmodmap2.

Shayan
  • 1,503
  • It is a bit confusing that it happens on plugging in USB headphones, though. I suppose it's the volume up/down keys that makes it register as a keyboard … – unhammer Jun 18 '18 at 12:36