DEBIAN-likes to detect the keyboard layout

0

I would like to find out the current keyboard layout of a debian-like OS. env-var? /etc/? locales?

Context: __ Playing around with RFID reader in serial, using python to output to console through uinput/

The thing is, doing the conversion from fake-rfid-keyboard-codes to code sent to uinput/, I would better know if I am using a QWERTY or an AZERTY ('a' becoming 'q', etc...)

Back here in Belgium, especially during the event I am working on we are highly susceptible to have both keyboard layouts, I have to support both 'on-the-fly' __

Thanx !

blietaer

Posted 2010-06-07T13:05:08.277

Reputation: 11

Answers

1

Use this to get the code for the current layout:

$(xset -q|gr LED| awk '{ print $10 }')

This might needs to be converted to a form you want, like:

case "$(xset -q|gr LED| awk '{ print $10 }')" in
  "00000002") KBD="English" ;;
  "00001002") KBD="Thai" ;;
  *) KBD="unknown" ;;
esac

Pepa

Posted 2010-06-07T13:05:08.277

Reputation: 11

0

I examined the postinst script for console-data package, and it appears that the /usr/share/console/getkmapchoice.pl will return the keymap name (or NONE if the kernel keymap is used). Note that it will only work if you have configured the keymap through APT, e.g. with dpkg-reconfigure console-data -plow.

whitequark

Posted 2010-06-07T13:05:08.277

Reputation: 14 146