• You are not logged in.
  • Index
  • Technical
  • Plugging in USB device resets keyboard settings (linux)

    Plugging in USB device resets keyboard settings (linux)

    • Started by stevep99
    • 6 Replies:
    • Reputation: 62
    • From: UK
    • Registered: 14-Apr-2014
    • Posts: 710

    Probably this is a question for DreymaR:

    I have noticed an annoying problem with using the xkb scripts. Whenever I plug/unplug a usb device (for example a headset), it has the effect of switching the keyboard layout. It seems to revert to some sort of default. I lose some of my settings, particularly remapped key codes. It's similar to this issue here except in my case it's Ubuntu.

    To fix, I can simply re-run the setxkb.sh script, but it's annoying having to do this every time I plug in a usb device.  Is it a known issue?

    Last edited by stevep99 (24-Aug-2016 09:22:34)

    Using Colemak Mod-DH with some additional ergonomic keyboard mods.

    Offline
    • 0
    • Reputation: 114
    • From: Oslo, Norway
    • Registered: 13-Dec-2006
    • Posts: 4,742

    Woo hoo, I haven't heard of that one before but it didn't surprise me as much as it should either. ;-)

    Are you using a new version of the script? setxkb.sh -a (and your specified layout of choice) should add a line to your .bashrc file (or another file if you specify one with -f <file>). I think that should be enough, but let me know otherwise. After adding the line you'll want to 'source ~/.bashrc'.

    Last edited by DreymaR (24-Aug-2016 15:37:41)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 62
    • From: UK
    • Registered: 14-Apr-2014
    • Posts: 710

    I am using the version from your github repo which I have forked. I noticed you had indeed updated the setxkb.sh script in the meantime, so I have now merged in the latest.

    Here is what I observe:
    In the system text entry settings, I have "English(Colemak[eD],Curl-DvbgHm ergo)". However this is effectively overridden by the setxb.sh script, which defines my custom mappings. I call this script on startup, and it works fine... until...

    When I plug in the headset, I notice the following changes:
    - The basic layout remains on Curl-DvbgHm but my AltGr/Extend layers are different and these revert back to the defaults.
    - I have some keycode remappings in keycodes/evdev which are also lost.

    I suppose this is not really a problem with your scripts, but rather an issue with Ubuntu itself: why does it feel the need to change anything related to keyboard settings whenever a USB device is plugged in? I think what is happening is it reverts back to the basic config selected in the "Text Entry" settings, so anything set with the script is lost.

    I do have a suggestion though: probably there is no need to include the xkb-backup-2016-01-02 directory in the repository? It makes is awkward to deal with as after installation git thinks these are changed source files.

    Last edited by stevep99 (25-Aug-2016 10:06:44)

    Using Colemak Mod-DH with some additional ergonomic keyboard mods.

    Offline
    • 0
    • Reputation: 114
    • From: Oslo, Norway
    • Registered: 13-Dec-2006
    • Posts: 4,742

    The xkb-backup dir is the original xkb files. I use that to compare with my changes; you could diff the backup vs mod dir and create a patch if you wanted to (it's what I did before). Whenever xkb-data is updated, the xkb-backup (and mod) dir has to change. How does that create problems?

    Yes, layout change in Ubuntu can be a PITA. There's three systems (I think) competing about who gets to decide. I've taken to using script activation via ~/.bashrc, as I found that safest. I haven't tried headphones so I haven't experienced your problem. You'll probably have to get your settings in gconf or something right, to fix it.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 6
    • Registered: 21-Apr-2010
    • Posts: 798

    Please state your OS and desktop environment.

    I have a different physical layout - a bluetooth apple keyboard, and that seems to get my computer tied in knots when trying to flip between the laptop and the remote keyboard.  To the point I've given up on it.  (Debian 7.9, Xfce 4.8.)  But perhaps that's a whole other can of worms to do with bluetooth or difference in physical layout.

    I used to have a keyboard changer icon and multiple layouts setup under Xfce, but occasionally it would crap out, and I'd find myself in another layout.  So in the end I just reduced the list to one, shame because when I was really procrastinating I might give Colemak a whirl.

    It's irritating when my partner wants to just hop on the laptop, and I have no Qwerty.  I _think_ it works okay under Debian 8.  I should investigate further.  There seems to be little issues under each and every new release and even some regression at times.  I get confused as to which setting is doing what.

    Last edited by pinkyache (31-Aug-2016 16:17:11)

    --
    Physicians deafen our ears with the Honorificabilitudinitatibus of their heavenly Panacaea, their sovereign Guiacum.

    Offline
    • 0
    • Reputation: 2
    • Registered: 25-Oct-2013
    • Posts: 136

    xkb is a fastidious thing.  I have found on Linux Mint / Ubuntu weird interactions between xkb and Gnome keyboard settings. I am used to just change the file (let's call the language NL)  /usr/share/X11/xkb/symbols/NL  But then that clashes with some Gnome (I think) settings....

    But this sounds like some udev issue. Perhaps a solution is finding the rules that define what must happen when a head set is introduced ?

    Offline
    • 0
    • Reputation: 2
    • Registered: 25-Oct-2013
    • Posts: 136

    By the way, pinkyache, you are a dvorak typer, right? Are you playing with Colemak nonetheless ? ;-)

    I use a "grand child" of Dvorak... that is, if Dvorak were the grandmother, (stock) AdNW is its daughter and I am using an AdNW-version I made for the Dutch language.... To my fingers, for Dutch (!),
    Querty is worse
    Colemak is much better
    Dvorak is even better
    Stock AdNW (hieao) is very good
    Dutch AdNW (saeio) is the best

    I just open a terminal and type setxkbmap -layout nl  and I'm done. Back to normal? setxkbmap -layout us

    Offline
    • 0
      • Index
      • Technical
      • Plugging in USB device resets keyboard settings (linux)