5

I'd like my Ubuntu to automatically switch my keyboard layout to English each time I lock the screen, so that I wouldn't have to do it manually each time to enter my password. How do I do that?

Also, I'd like that my keyboard layout also be English each time after I unlock the screen. Is it possible?

whyer
  • 549

3 Answers3

0

Just bumped into the same problem, use xkblayout-state tool like this (assuming 0 is the default En keyboard layout)

xkblayout-state set 0

then you can first change the keyboard layout to the default and launch screenlocker like this

 xkblayout-state set 0 && screen_locker
0

If you don't want to dive into command line, you can configure keyboard layout switcher to remember layout for each window. As the lock screen has it's own window, it will use the first keyboard layout regardless of which language you were typing before.

In KDE: System Settings -> Input devices -> Keyboard -> Layouts -> set Switching Policy to Window. You will also need to set your first layout to English.

pelya
  • 101
0

Since xkb tools do not work on Wayland, I wrote an extension that solves the problem by automatically resetting keyboard layout when screensaver activates. You can get extension here: https://github.com/galets/gnome-keyboard-reset

galets
  • 684