7

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"
4
  • Can you please edit your question and show us what this command outputs: cat /etc/default/keyboard Oct 31, 2019 at 17:56
  • @GunnarHjalmarsson: I added the contents of the file in the question.
    – user000001
    Oct 31, 2019 at 19:20
  • Thanks. My theory was that that file might not have English first in the list, but I see that it has. So the problem seems to be specific to the design of the lock screen. Oct 31, 2019 at 19:47
  • I had the same problem since Ubuntu 22.04 upgrade. My preferred language was first in the list, so I just removed all other languages.
    – xtermi2
    Aug 19, 2022 at 14:58

3 Answers 3

2

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.

1

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.

0
0

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:

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Apr 28, 2023 at 12:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .