I wonder if with some Perl Preprocessing it would be possible to simplify fvwm configuration files. For example, I have defined the following key-bindings using the numeric keypad:
[code]# KEYPAD: Switch pages via keypad (no modifier)
Key KP_Home A N GotoDesk 0 0
Key KP_Up A N GotoDesk 0 1
Key KP_Prior A N GotoDesk 0 2
Key KP_Left A N GotoDesk 0 3
Key KP_Begin A N GotoDesk 0 4
Key KP_Right A N GotoDesk 0 5
Key KP_End A N GotoDesk 0 6
Key KP_Down A N GotoDesk 0 7
Key KP_Next A N GotoDesk 0 8
alt: Move a window to a different page
Key KP_Home A M MoveToDesk 0 0
Key KP_Up A M MoveToDesk 0 1
Key KP_Prior A M MoveToDesk 0 2
Key KP_Left A M MoveToDesk 0 3
Key KP_Begin A M MoveToDesk 0 4
Key KP_Right A M MoveToDesk 0 5
Key KP_End A M MoveToDesk 0 6
Key KP_Down A M MoveToDesk 0 7
Key KP_Next A M MoveToDesk 0 8
ctrl: Show menus
Key KP_Home A C Menu Utils
Key KP_Up A C Menu Gent
Key KP_Prior A C Menu Oficina
Key KP_Left A C Menu Internet
Key KP_Begin A C Menu Sistema
Key KP_Right A C Menu Oci
Key KP_End A C Menu Xarxa
Key KP_Down A C Menu
Key KP_Next A C Menu Global[/code]
And some more, meaning that my key-binding definition is about 200 lines long. For example in awesome, using lua, all this lines can be greatly reduced (see this link). I was wondering if this can be achieved with some Perl Preprocessing or some kind of perl module. I have found some examples like this one that uses fvwm preprocessing, but only on short expressions. I have been unsuccessful at something like this:
[code]%{
{my @keys = qw /KP_Home KP_Up KP_Prior KP_Left KP_Begin KP_Right KP_End KP_Down KP_Next/;
my $i = 0;
foreach (@keys) {
{ “Key $_ A N GotoDesk 0 $i\n”; }
++$i;
}
}%[/code]
Thanks for your attention!