You are not logged in.

#1 2009-07-04 21:23:36

geo909
Member
Registered: 2008-09-07
Posts: 309

Showing keyboard layout

Hi all,

I am Greek so I have to switch keyboard layouts every now and then (with alt+shift). This is the
corresponding xorg lines:

Section "InputDevice"
    Identifier    "Generic Keyboard"
    Driver        "kbd"
    Option        "XkbRules"    "xorg"
    Option        "XkbModel"    "pc105"
    Option        "XkbLayout"    "us,gr"
    Option        "XkbVariant"    ","
    Option        "XkbOptions"    "grp:alt_shift_toggle,grp_led:scroll"
EndSection

Now, I am using the dwm window manager and using xsetroot to display info in my status bar.
I would really like to display the current layout.

So, I was wondering, is there some command/variable/whatever one could use in a script or in the command
line that shows the current layout? (in my case "US" or "GR")? I could use that in conky too..

Thanks a lot in advance..

Offline

#2 2009-07-04 21:30:03

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: Showing keyboard layout

that's awful:
echo `setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}'`

Offline

#3 2009-07-04 21:48:29

geo909
Member
Registered: 2008-09-07
Posts: 309

Re: Showing keyboard layout

whoops wrote:

that's awful:
echo `setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}'`

Hey,

thanks a lot for the reply. Though this doesn't work...
I'm not sure if I made clear what I want though, the output of "setxkbmap -print" does not
change when I switch layouts. What I would like is something that outputs "us" when my keyboard
is set to English and "gr" when it is set to Greek..

Thanks again

Offline

Board footer

Powered by FluxBB