Awk script to autogenerate FVWM help screen

FVWM forms is quite useful, and one thing I like to have is a help screen which will display my custom key bindings. This awk script can create such a form configuration based from a file which defines FVWM key bindings.

I keep all my bindings in a file called ‘bindings’ (the one created by FVWM2 originally). I used to maintain a form which I could call up with “Super Key - H”, which would list the bindings, in case I forgot. But I thought, why not generate the form from the bindings file, instead of adding entries manually?

So this script was born. You will most definitely want to fiddle with the fonts and colours used.

Feed this awk script your fvwm bindings, and it will output a form configuration which you can call up in FVWM which will document those bindings. Redirect the output to a file, then read that file in somewhere in your fvwm startup config, or copy the output into some other file.

The FVWM command “FvwmForm HelpForm” will bring it up. Change the configuration in the “BEGIN” section to your liking.

This script will ONLY document Keybindings, and ONLY those which are defined with the word “KEY” in ALL CAPITALS. Lines with “Key” at the start will be ignored. This way, you can choose which keybindings to have documented in the help form simply by capitalising the entire word of the “Key” command at the start of the line. Following this binding definition line there MUST be a comment line starting with a “#”, and this will contain the description of what the key does.

The ask script is here…

Do you know about PrintInfo Bindings which exports all current bindings to stderr (often ~/.xsession-errors. You might find that useful too.

I did look at that, but it strips out the capitalisation and the comments. It might work if you wanted to include every single keybinding, and simply display the command, rather than a description of the command, but I didn’t find that suitable for my purposes.