November 19, 2012

How to change keyboard layout in xmonad

Here is my ~/.xsessionrc which allows to change keyboard layouts in xmonad by pressing both shift keys.

#!/usr/bin/env bash
setxkbmap -option  -layout us,ru \
-option grp:shift_toggle \
-option grp_led:scroll :2

This should also work for other window managers.

Beware: .xinitrc doesn't work in Ubuntu 12.04; make sure to put your personal X session commands into ~/.xsessionrc