profile
viewpoint

Ask questionsHow to get current keyboard layout?

Keyboard layout switching configs described in wiki work well, but I don't know the way to get current layout. Is there any? Thanx.

swaywm/sway

Answer questions l4l

swaymsg -t get_inputs | jq '.[0].xkb_active_layout_name'

That works for me, @ianhattendorf, may you also try it? It though prints full layout name, rather than 2-letters. jq util is form here, you may use any other json utility for that. For me keyboard is the first element in inputs array, so if it differs for you, you should replace [0]

useful!
source:https://uonfu.com/
Github User Rank List