How to maintain language of lock screen?

Half the time the computer locks, the language of the focused window isn’t set to English, so I enter the password in the lock screen in the wrong language.

Is it possible to maintain the language of the lock screen to the previous one in the lock screen, and not the one that was last used?

I have already enabled the

Allow different sources for each window

option in the Input Source Options.


Edit: As requested in the comments, these are the contents of /etd/default/keyboard:

$ cat /etc/default/keyboard
XKBLAYOUT="us,gr"
XKBVARIANT=","
BACKSPACE="guess"
XKBMODEL="pc105"
XKBOPTIONS="grp:alt_shift_toggle,grp_led:scroll"
Asked By: user000001

||

I found this answer to help.

Inside of Region & Languages under Settings, Login Screen default can be selected after creating a new account.

Be careful as the settings are irreversible once set. If you reboot and change the language to Russian, you won’t be able to login.

Answered By: Sam Klein

having the same issue, I resulted to a single solution which is a combination of answers I found.

this solution creates a script that will listen to lock screen events (via org.gnome.ScreenSaver), and change the language using the GNOME extension and app g3kbswitch.

for GNOME 42+:

  1. install g3kb-switch https://github.com/lyokha/g3kb-switch according to the instructions in github (pull, install dependencies, compile and install app and extension)

  2. find the language id that you want to have in the lock screen by running gdbus call --session --dest org.gnome.Shell --object-path /org/g3kbswitch/G3kbSwitch --method org.g3kbswitch.G3kbSwitch.List (you should get output like (true, '[{"key":"0","value":"us"},{"key":"1","value":"il"}]') and if you want "en" to be the lock screen language, you’ll need to use the key 0)

  3. create a script, call it e.g. lock-screen-lang.sh, and replace 0 in Set 0 with the key from the previous step:

#!/bin/bash
dbus-monitor --session "type=signal,interface=org.gnome.ScreenSaver" |
  while read MSG; do
    MSG_STAT=`echo $MSG | grep boolean | awk '{print $2}'`
    if [[ "$MSG_STAT" == "true" ]]; then
      gdbus call --session --dest org.gnome.Shell --object-path /org/g3kbswitch/G3kbSwitch --method org.g3kbswitch.G3kbSwitch.Set 0 > /dev/null 2>&1
    fi
  done
  1. give the script executable permission: chmod +x lock-screen-lang.sh

  2. add the script to GNOME startup by running gnome-session-properties, and adding a new item, selecting the script you’ve created.

note: although this is a workaround, since the bugs for this are opened for years, it’s probably worth having.

related bugs:

resources:

Answered By: Nben

I have been experiencing the same issue, and it annoyed me so much, that in order to expedite the solution in a single package, I created following gnome extension.

Answered By: galets