Is there a utility that allows to graphically display the current keyboard layout?

This can be useful, for example, when writing in a foreign language and having the physical keyboard only indicating the local language (positioning of symbols, etc.). I would like to get a display similar to the following: enter image description here


xkeycaps seems to do what you want, if I understand you correctly.

| improve this answer | |
  • Indeed! I had it installed, but forgot the command. – landroni Jan 30 '14 at 9:22
  • 3
    This will not work (= display the current mapping visually as a picture), if the user has made changes to the keysyms with e.g. xmodmap. If you mouseover the changed key(s), the keysym line in the top half of the xkeycaps is updated correctly though. I am researching the same question, but I have made lots of changes with xmodmap. So I was looking for a nice means to display current key mappings too. – Alex Stragies Nov 20 '16 at 20:45

From the command line: gkbd-keyboard-display -l ir

To see what your installed keyboards are (for example to find the country code) use setxkbmap -query

| improve this answer | |

You can use xkbprint to print the current layout.

For example to print the current layout as PDF use

xkbprint -color "${DISPLAY}" - |\
    ps2pdf - > current_keyboard_layout.pdf

which produces:

xkbprint result

| improve this answer | |

Selecting the current layout with gkbd-keyboard-display is possible like so:

#! /usr/bin/env fish
set layout (setxkbmap -query | grep layout | tr -s ' ' | cut -d ' ' -f2)
set variant (setxkbmap -query | grep variant | tr -s ' ' | cut -d ' ' -f2)
gkbd-keyboard-display -l $layout\t$variant

Or, similarly:

#! /bin/bash
layout=`setxkbmap -query | grep layout | tr -s ' ' | cut -d ' ' -f2`
variant=`setxkbmap -query | grep variant | tr -s ' ' | cut -d ' ' -f2`
gkbd-keyboard-display -l ${layout}$'\t'${variant}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.