Keyboard layout always lost in live

Forum Forums New users New Users and General Questions Keyboard layout always lost in live

  • This topic has 3 replies, 3 voices, and was last updated Jan 28-11:24 pm by Robin.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #76166
    Member
    Robin

      While setting up antiX 21 step by step for my two PCs in order to switch from 17 and 19 to 21 once it will run perfectly, I met the following pressing problem:

      Using antiX (same on 19 and 21) with either a remastered USB stick or with persist-all option all the keyboard settings are always lost/reset after reboot. E.g I need two different keybord layouts for working in translations, so I have to set my default to

      1st keyboard layout: de, de
      2nd layout: ru, ru (typewriter, kyrillic)

      The first layout (German) remains present after reboot, but the second one (Kyrillic, Russian Typewriter) is always reset to en_US, so I have to repeat the following settings:

      After going to antiX control center → system → system wide keyboard layout setup

      1.) from tab "layout" remove "en_US" keyboard layout.
      2.) in tab "layout" add "ru ru_RU typwriter layout" as second layout.
      3.) in tab "hotkeys" set layout switch to "right ctrl + right umschalt".
      4.) in tab "Advanced" set layout indicator to "none".

      All these settings are lost after next reboot, and its quite annoying since it takes some time again and again.

      I tried different ways of saving:

      — The normal persist-all saving doesn’t prevent from the reset to US keyboard as second layout after reboot.
      — A live remaster also doesn’t prevent from the reset to US keyboard as second layout after reboot.

      Did I miss something, or what else could I do to make this setting permanent on live systems?

      So I decided to find the files where the settings are stored, possibly having them restored by a startup command from a manual backup copy (no idea how this could be done, but its a beginning). After some researching I succeded in finding the program finally which creates these settings. It is the script

      $ which fskbsetting
      /usr/bin/fskbsetting

      But while inspecting this script it looks as if it doesn’t do anything but importing two libraries and then exiting. So I don’t have any clue how to go further in analysing where (to which files) all the settings of this go. There is no command within this python script to store the settings to a file, and no, there don’t seem to be any commands at all, besides from an exiting command. So how does all this work? (I’m not that familiar with python, maybe I misread something)

      But what is most important to me is:
      What do I have to change or set to make the user defined keyboard layout settings permanent in antiX live (remastered and/or persist-all)?

      Robin

      Windows is like a submarine. Open a window and serious problems will start.

      #76216
      Member
      sybok
        Helpful
        Up
        0
        ::

        Hi, this is not a solution but rather a workaround:
        1) Add the below line to ‘~/.desktop-session/startup’:
        setxkbmap <primary keyboard>

        2) I have a script invoked by an appropriately defined keyboard shortcut:

        #!/bin/bash
        ## Switch xkbmap, alternate between primary and secondary:
        
        primary='us'
        seconds='cz_qwerty'
        
        current="$(setxkbmap -query | grep '^layout:' | awk -F: ' { print $2 } ' | xargs)"
        
        if [ "${current}" == "${primary}" ]; then
          setxkbmap "${seconds}"
        elif [ "${current}" == "${seconds}" ]; then
          setxkbmap "${primary}"
        else
          echo "Current layout [${current}], switching to [${primary}]"
          setxkbmap "${primary}"
        fi
        #76218
        Forum Admin
        anticapitalista
          Helpful
          Up
          0
          ::

          2 options.

          1. At live boot menu, type

          kbd=de,ru

          Use F8 to save for future reboots.

          OR

          2. After setting up your keyboard, copy /etc/default/keyboard to /usr/local/share/live-files/general-files/etc/default/

          This should persist and get set when remastered (though not 100% sure about that).

          Philosophers have interpreted the world in many ways; the point is to change it.

          antiX with runit - leaner and meaner.

          #76302
          Member
          Robin
            Helpful
            Up
            0
            ::

            Many thanks @sybok and @anticapitalista !

            Here the results:

            First I tried the method

            2. After setting up your keyboard, copy /etc/default/keyboard to /usr/local/share/live-files/general-files/etc/default/
            This should persist and get set when remastered (though not 100% sure about that).

            After remaster and reboot the file
            /etc/default/keyboard to /usr/local/share/live-files/general-files/etc/default/keyboard
            shows the expected content still:

            $ cat /etc/default/keyboard
            # KEYBOARD CONFIGURATION FILE
            
            # Consult the keyboard(5) manual page.
            
            XKBMODEL="pc105"
            XKBLAYOUT="de,ru"
            XKBVARIANT=",typewriter"
            XKBOPTIONS="terminate:ctrl_alt_bksp,grp:rctrl_rshift_toggle"
            
            BACKSPACE="guess"

            But the Keyboard is reset to the pair DE and US, also the indicator and layout switch. The file
            /etc/default/keyboard
            is overwritten from somewhere back to

            $ cat /etc/default/keyboard
            # KEYBOARD CONFIGURATION FILE
            
            # Consult the keyboard(5) manual page.
            
            XKBMODEL="pc105"
            XKBLAYOUT="de,us"
            XKBVARIANT=""
            XKBOPTIONS=""
            
            BACKSPACE="guess"

            So I tried the first method now:
            kbd=de,ru

            which actually comes up with the language pair DE and RU. But Russian layout has now the wrong variant, layout switch and indicator is also reset to left alt and left shift, and the scroll indicator lights up. The file
            /etc/default/keyboard
            shows now:

            $ cat /etc/default/keyboard
            # KEYBOARD CONFIGURATION FILE
            
            # Consult the keyboard(5) manual page.
            
            XKBMODEL="pc105"
            XKBLAYOUT="de,ru"
            XKBVARIANT=","
            XKBOPTIONS="terminate:ctrl_alt_bksp,grp:rctrl_rshift_toggle"
            
            BACKSPACE="guess"

            (strange enough: there is the option grp:rctrl_rshift_toggle present.)

            So now I checked your workaround @sybok, and this looks promising.
            Even when you only use a single keyboard layout in the command and script, man setxkbmap tells me that it takes more layouts and also variants and options in a single command call.

            So I tried
            setxkbmap de,ru ,typewriter terminate:ctrl_alt_bksp,grp:rctrl_rshift_toggle

            at command line, which gave me the desired result immediately. So I’ll probably end up in puting this line to some autostart script run when desktop comes up. (Note the syntax of the variant argument. It has to be preceded by a comma here, since it expects the variants in the same sort order as the layouts before, and for the DE layout I didn’t want to file a variant.)

            Is it correct (or best practise) I should add it here?

            1) Add the below line to ‘~/.desktop-session/startup’

            But first I’ll try whether the bootcode kbd= would take all these options the same way. This would have the drawback I’d have to retype them again and again at boot screen, due to the fact I can’t boot antiX 21 from USB stick directly like I was used to in antiX 17 on this PC, so I have to use from=usb always, after powering up with a DVD first. Maybe I’ll see a different behaviour on the notebook, which allows antiX 21 still to be booted directly from USB.

            What I didn’t test by now is, @anticapiatalista, whether your method 2 would work in an live persist-all system. I could only check with non persistent remaster so far. Will let you know once I come to this step and can test this also.

            Windows is like a submarine. Open a window and serious problems will start.

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.