S
S
Stepan Krapivin2020-04-12 21:23:55
mint
Stepan Krapivin, 2020-04-12 21:23:55

How to track keyboard layout changes from the command line?

I installed linuxmint cinnamon 19.3
I set up two layouts us and ru everything works, the layout switches, in the panel the indicator shows that the layout has switched. All OK.

The task is to get the current keyboard layout from a bash script.
I tried the method that I used in another distribution:

dconf watch /org/gnome/desktop/input-sources/current

but since cinnamon is not gnome this way doesn't work.
Changed "gnome" to "cinnamon" but no results.
dconf watch /org/cinnamon/desktop/input-sources/current

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SOTVM, 2020-04-13
@xevin

through crutches:
in the settings of the keyboard, when using a different layout, "light the LED"
Use keyboard LED to show alternative layout Scroll Lock
i.e.
if the LED is on, it means RU (returns 1), if there is no EN (returns 0)
, I get the values ​​​​as follows

xset -q | sed -rn 's/.*LED mask.*(.){3}/\1/p'

in short, data can be pulled from the output of the xset -q
command, see LED mask: 8 digits
or "via LED on/off" Scroll Lock: on/off

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question