Solved xsetkbmap does not persist after resume

I have the following commands in .xinitrc

```
setxkbmap -layout us,ara -option grp:win_space_toggle
setxkbmap -option caps:escape
```

and they are working fine, however when I resume the system after suspend they don't work anymore and I have to execute them again from the terminal. any work around ? and why its happening ?
 
Although I start my X with lightdm I recognize the problem with lost keyboard layout after suspend.
What fixed it for me was creating a file /usr/local/etc/X11/xorg.conf.d/keyboard.conf with the following contents
Code:
Section "InputClass"
        Identifier      "KeyboardDefaults"
        MatchIsKeyboard "on"
        Option          "XkbLayout" "se"
        Option          "XkbModel" "pc105"
EndSection
which solved my issues.
It is possible that something similar with the right options would solve your problem.
 
Although I start my X with lightdm I recognize the problem with lost keyboard layout after suspend.
What fixed it for me was creating a file /usr/local/etc/X11/xorg.conf.d/keyboard.conf with the following contents
Code:
Section "InputClass"
        Identifier      "KeyboardDefaults"
        MatchIsKeyboard "on"
        Option          "XkbLayout" "se"
        Option          "XkbModel" "pc105"
EndSection
which solved my issues.
It is possible that something similar with the right options would solve your problem.
that worked thank you, but only switching layouts works but caps does not map to escape, I tried to swap the toggle and caps options and find out that it just ignores what afters the first XkbOptions idk why

Code:
Section "InputClass"
    Identifier      "KeyboardDefaults"
    MatchIsKeyboard "on"
    Option          "XkbLayout" "us,ara"
    Option         "XkbOptions" "grp:win_space_toggle"
    Option        "XkbOptions" "caps:escape"
EndSection

Edit: Solved by separting with comma like this

Code:
Section "InputClass"
    Identifier      "KeyboardDefaults"
    MatchIsKeyboard "on"
    Option          "XkbLayout" "us,ara"
    Option         "XkbOptions" "grp:win_space_toggle,caps:escape"
EndSection
 
Back
Top