Bug#593099: /usr/bin/setxkbmap: bash: getting current keymap
Package: x11-xkb-utils
Version: 7.5+5
Severity: minor
File: /usr/bin/setxkbmap
I'm writing a little bash script that will toggle the keymap. I am currently using "setxkbmap -print|grep -q $KBD1" to check the current keymap. It's working fine for this case but I am wondering if there is a command that returns the current keymap. I've read man pages for setxkbmap, xmodmap, etc but couldn't find anything.
#!/bin/bash
KBD1=us
KBD2=ca_enhanced
if setxkbmap -print|grep -q $KBD1
then
setxkbmap $KBD2
else
setxkbmap $KBD1
fi
it could be useful that setxkbmap says which one is currently using :
de, fr, us, ca ;;; or customed ...
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-5-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages x11-xkb-utils depends on:
ii libc6 2.11.2-2 Embedded GNU C Library: Shared lib
ii libx11-6 2:1.3.3-3 X11 client-side library
ii libxaw7 2:1.0.7-1 X11 Athena Widget library
ii libxkbfile1 1:1.0.6-2 X11 keyboard file manipulation lib
ii libxmu6 2:1.0.5-1 X11 miscellaneous utility library
ii libxt6 1:1.0.7-1 X11 toolkit intrinsics library
ii x11-common 1:7.5+6 X Window System (X.Org) infrastruc
x11-xkb-utils recommends no packages.
x11-xkb-utils suggests no packages.
-- no debconf information
Reply to: