title: get current active keyboard layout(language) in linux
body: <p>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. </p>
  
  <p>I know how to get the list of possible layout:</p>
  
  <pre><code>$ setxkbmap -query | grep layout
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>layout:     us,ru
  </code></pre>
  
  <p>But how to know which one is selected right now? (for the current window)</p>