Borax Mans Pad
  • About
  • Blog
  • Articles
  • Levels
  • My Computing Setup
  • Programs
  • Links

Fvwm Keyboard shortcut help screen generator

Keyboard shortcuts are THE superior way to quickly access some much needed and frequently used function. Most GUIs, Windows and MacOS included, will allow you to define your own shortcuts. Here, I’m talking about FVWM, which has a very flexible method where you can create keyboard shortcuts that do anything, anywhere.

I define quite a few keyboard shortcuts, keybindings if you will, because I don’t like to reach over to the mouse and navigate to some menu or button. The problem is, if you’ve got quite a few keybindings, you might not always remember them. Luckily, there is a way with FVWM where you only ever really need to remember one, the one that brings up the help screen which lists the keybindings you’ve configured and what they do!

Fvwm has an FvwmForm module, which you can use to build simple graphical forms. You may have already used this if you’ve brought up Fvwm’s own configuration forms. This will likely be superseded by FvwmScript sometime in the future, but in the meantime we can use it.

How it works

All this help screen generator script does, is it takes an FVWM configuration file as input, finds the lines which define keybindings, and outputs the definition of an Fvwm form.

How to use

Install

The help screen generator is an awk script, and is available here . Save this script and make it executable. chmod a+x makehelpform.awk

I keep it in my ~/.fvwm directory.

Set up the keybinding that will bring up the help form

You will need to create a keybinding to bring up the help form itself. Add the line below to your fvwm configuration file where you have your keybindings. The line below is configured to use “Windows Key + H” as the shortcut, but you can change it as you see fit.

Key H A 4 FvwmForm HelpForm

Choosing which keybindings to document

By default, the form will ignore all keybindings. What it looks for, is any line which defines a key where the word KEY is capitalised. This way, you can choose which keybindings to include in the form, and which to not include. I only bother with the keybindings which work in all contexts for common tasks, otherwise the list gets too long!

For each keybinding you want to document, change the word “Key” at the start of the line to “KEY”. The line must immediately be followed by a comment which describes what the key does.

An example which documents the “CTRL-SHIFT-ALT P” key combination as one which runs ‘redpass’ is…

KEY P		A MCS	Exec exec redpass
#Password Manager`
Creating the help form

Just run the script, giving the file which lists the keybindings as input, and the file “helpform” as output. HelpForm must be in your ~/.fvwm directory, or any other directory in FVWM’s search path.

An example below, which assumes the keybindings are in a file called “bindings”.

./makehelpform.awk < bindings > helpform

That’s it. The colour scheme is defined in the AWK file itself, so edit it if you don’t like my tacky colour choice.

Now anytime you press “Windows key + H”, you’ll get a help screen like this…

FVWM Help Form
Fvwm Help Form.

Other

If you do want to document all key bindings, you could change the following line in the awk script

$1 ~ /KEY/ {

to

$1 ~ /Key/ {

so you don’t need to bother with the capitalisation. You would still have to add a comment after every keybinding.

Back to Home


© Dennis Katsonis 2025

GitGud