Last Updated: February 25, 2016
·
2.397K
· rumith

XFCE lock screen and keyboard layout problem

As a multilingual user, I often encountered the problem of correctly entering the password when the xflock4 program is active (e.g. when waking up my laptop), since the layout indicator is nowhere to be found.

alt text

A quick search shows that there are many people suffering from the same problem. While it is surely possible to modify xflock4 to display the current layout, my solution is much more simple.

  • Download and install xkb-switch from https://github.com/ierton/xkb-switch.

  • Save the following script as /usr/local/bin/xflock4.

    #!/bin/bash
    xkb-switch -s us
    /usr/bin/xflock4
  • Set the executable privileges (chmod a+x /usr/local/bin/xflock4).

You're done! Note that I assume that your password is typed in the us keyboard layout; if not, change the layout specified in the second line of the script.