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.

1 Answers1

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.