Is there any tool that produces a diagram of the current keyboard layout, and shows secondary characters typed when pressing Shift or Alt Gr (or is editable so I can manually add those)?
An example from Wikipedia:
You can use the windows built in tools "On Screen Keyboard" and the "Snipping Tool" to get an image of the current keyboard layout: Then the one with the AltGr button pressed:
And use just about any image editing program, personally I used Gimp, to recolor and merge one on the other with a little offset for clarity:
On Windows,
Patorjk's Keyboard Layout Analyzer webapp is closest, it shows similar diagrams in-between steps, and in its analysis output, but the ones customly generated by it have colors.
Ian's Keyboard Layout Editor webapp is also used by Wikipedia contributors.
Microsoft's Keyboard Layout Creator can be used to generate diagrams.
DreymaR's 'E' Portable Keyboard Layout (it's like the 'G' in GNU) can generate diagrams with its Help Image Generator. It can also shows secondary characters from the Shift
and Ctrl
layers in real-time.
PassMark's Keyboard Test (paid) generates a diagram corresponding to your keyboard, and moreover it changes dynamically with keypresses. Thanks to this answer.
Martijn Smit's WhatPulse has a diagram showing hotspots for frequently pressed keys.
univrsal's Input Overlay lacks a whole keyboard layout diagram, but by default offers a partial one, plus customizability, and real-time graphics. It's limited for usage within OBS.
TheNohT's NohBoard has a customizable keyboard layout that displays pressed keys in real-time. Unlike EPKL, this is neither verbosely documented nor is technically overcomplex. I recommend this for Windows. Thanks, univrsal.
On Linux/Unix,
GNOME Desktop can use gkbd-keyboard-display through a terminal or GUI to show an image of a layout. This is Tecla if your version is >=45.
X Window System's xkbprint can generate diagrams through a terminal. This is also used by Wikipedia contributors.
KDE Plasma Desktop through the settings GUI calls tastenbrett to display a layout image.
Both Arensito's webpage and IndLinux share, between themselves, a similar keyboard layout diagram, but I don't know how they were generated.
Finally, it seems Wikipedia's most popular keyboard diagrams are handmade edits of Denelson83's US layout, as seen in this history.