如何绘制当前的键盘布局?

时间:2011-09-01 08:52:13

标签: linux keyboard

我想绘制当前键盘布局的ascii版本。这样的东西,但所有的钥匙:

  +---------------------------------------+
  | q | w | e | r | t | y | u | i | o | p |
  | a | s | d | f | g | h | j | k | l |   |
  | z | x | c | v | b | n | m |           |
  +---------------------------------------+

关于如何做到这一点的任何想法?如果你知道这样的应用程序,请告诉我。

谢谢!

1 个答案:

答案 0 :(得分:1)

您应首先获得键盘布局,然后根据布局类型打印键盘。认为你应该创建一个布局类型的地图和自己打印。

获取键盘:     cat / etc / default / keyboard

将回显以下内容并搜索XKBLAYOUT。

# If you change any of the following variables and X is configured to
# use this file, then the changes will become visible to X only if udev
# is restarted.  You may need to reboot the system.

# The following variables describe your keyboard and can have the same
# values as the XkbModel, XkbLayout, XkbVariant and XkbOptions options
# in /etc/X11/xorg.conf.

XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""

# If you don't want to use the XKB layout on the console, you can
# specify an alternative keymap.  Make sure it will be accessible
# before /usr is mounted.
# KMAP=/etc/console-setup/defkeymap.kmap.gz