In my C/C++ program I want to know which language is user going to type. I mean the language whose ID is displayed in the corner of the task bar. Like EN or RU or ZH or FR or IT.
I know how to get the list of possible layout:
$ setxkbmap -query | grep layout
output:
layout: us,ru
But how to know which one is selected right now? (for the current window)