1

I've got a Ubuntu 20.10 Desktop virtual machine, running with VMWare. Ubuntu is installed using the "easy install" feature of VMWare. By default, this sets the keyboard language to English US, however I want my keyboard language (and my system in general) to be English UK.

I'm aware I can change the language manually using the Input Sources setting under Language and Region, but I'm trying to automate all the changes I want to make to a brand new VM. So I want to get the effect of changing the language using the graphical menu, but via command line using a Bash script.

Using setxkbmap gb works as a temporary solution, and I could put this in my .bashrc file but then I'd need launch a command prompt every time I log in before the language changes. I've tried putting setxkbmap gb in rc.local but that doesn't seem to do anything. I've also read about setting XKBLAYOUT=gb in /etc/default/keyboard but this doesn't seem to do anything either (no change after reboot nor after running sudo udevadm trigger --subsystem-match=input --action=change as described here).

Any suggestions on how I can set my keyboard to English GB using the command line only and without any interactive prompts?

1 Answers1

1

You are probably looking for:

gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'gb')]"

But with that said, changing /etc/default/keyboard as you suggested makes sense too. That setting is effective on the login screen and TTYs.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94