In X11 with the Xkb extension you can configure simplified vector drawings of your input devices, which any application can query. It is intended that applications use these drawings in their help systems and tutorials, as well as in their key binding editors. Few applications bother though.
https://www.x.org/releases/current/doc/libX11/XKB/xkblib.htm...