1

I want a script to run when I press a keyboard shortcut, but only if I’m using a specific keyboard layout (I have 4 installed).
I figured the easiest way to do this was with the keyboard layout environment variable (provided there is one), but I couldn’t find anything of the sort.

Any help is welcome. I’m open to other ideas, I just thought this would be easiest.

0

1 Answer 1

1

Right, there is no environment variable with that info.

If you are on standard Ubuntu 20.04 LTS, the keyboard layout in use is the first one in the list generated by this command:

gsettings get org.gnome.desktop.input-sources mru-sources

However, I just found out that that does not work as expected on Ubuntu 20.10. Maybe related to this issue.

3
  • I get @a(ss) [] back when I run this. I also need it in a variable, so I can use it in a script. I’m running Zorin OS 15.3, I don’t know what version of Ubuntu it’s based in. Feb 8, 2021 at 12:27
  • @RowanAckerman: Zorin is off topic at Ask Ubuntu. Try unix.stackexchange.com instead. Feb 8, 2021 at 12:42
  • OK. From past experience, their terminals are almost identical, so what works for Ubuntu, works for Zorin. Evidently this is not always the case. I’ll ask this on unix/linux. thanks. Feb 8, 2021 at 13:42

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