I'm trying to do something similar to what this user asked, storing my keyboard layout. My first thought was to use .bashrc
, but I turned to .bash_profile
after realizing that I only need it set once (and not for every bash I start), as also suggested in that answer. However, I've noticed that the keyboard layout resets at certain points, and I'm not sure how to debug this (is it being set at all? when is it reset exactly?). Here's what is in my .bash_profile
:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
setxkbmap -layout us -variant altgr-intl -option nodeadkeys
This sometimes works. I've noticed in particular that this fails when I remove my laptop from my docking station and switching to the laptop screen, instead of my monitors, because this also seems to cause the keyboard layout to be reset (to plain US English, i.e., without altgr-intl). I thought this might have something to do with it, so here's the script I use to change the configuration :
xrandr --output VIRTUAL1 --off --output DP3 --mode 2560x1440 --pos 0x0 --rotate normal --output DP2 --off --output DP1 --off --output HDMI3 --off --output HDMI2 --off --output HDMI1 --off --output LVDS1 --off --output VGA1 --off
xrandr --output VIRTUAL1 --off --output DP3 --off --output DP2 --off --output DP1 --off --output HDMI3 --off --output HDMI2 --off --output HDMI1 --off --output LVDS1 --mode 1366x768 --pos 0x0 --rotate normal --output VGA1 --off
I thought it might have something to do with the fact that I turn off all output devices, which might cause X to freak out. I'm running Fedora 22 with i3 as window manager.
setxkbmap
is bound to the X session and it can have problems when you switch X sessions or basically "play around" with it.loadkeys
might be of help here, since it is X-independant. (consult man pages)