#!/bin/awk -f # 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. # e.g # KEY H A MCS FvwmForm HelpForm # #Bring up Help Form BEGIN { printf("%s","DestroyModuleConfig HelpForm: *\n \ *HelpForm: Title \"Key Bindings\"\n\ *HelpForm: WarpPointer\n\ *HelpForm: Back LightGreen\n\ *HelpForm: Fore Black\n\ *HelpForm: Line center\n\ *HelpForm: Font -*-helvetica-bold-r-normal-*-18-*-*-*-*-*-*-*\n\ *HelpForm: Text \"Custom Key Bindings for FVWM\"\n\ *HelpForm: Line expand\n\ *HelpForm: Font -*-terminus-bold-r-normal-*-14-*-*-*-*-*-*-*\n") } $1 ~ /KEY/ { n = 0 key = $2 mod = $4 getline desc if(substr(desc,1,1) == "#") { printf("%s","*HelpForm: Line expand\n\ *HelpForm: Fore DarkBlue\n\ *HelpForm: Text \"") if(match(mod,"C")) { printf("Control") n++ } if(match(mod,"M")) { if(n) printf("+") printf("Alt") n++ } if(match(mod,"S")) { if(n) printf("+") printf("Shift") n++ } if(match(mod,"4")) { if(n) printf("+") printf("Super") n++ } printf(" %s\"\n",key) printf("%s","*HelpForm: Fore DarkGreen\n\ *HelpForm: Text \"") printf("%s\"\n",substr(desc,2)) } else { print "No comment line after keybinding for line",$0 > "/dev/stderr" } } END { printf("%s","*HelpForm: Line expand\n\ *HelpForm: Button quit \"Close\" ^X\n") }