I want to draw an ascii version of the current keyboard layout. Something like this, but with all keys:
+---------------------------------------+
| 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 | |
+---------------------------开发者_开发知识库------------+
Any idea on how to do that? If you know of an app like that, please let me know.
Thanks!
You should get the keyboard layout first and then based on the layout type print the keyboard. Think you should create a map of the layout types and the printing yourself.
Get keyboard: cat /etc/default/keyboard
Will echo the following and search for 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
精彩评论