You want to look at what fvwm-themes does.
Well, I have a menu which will list colorsets for me. Basically, it consists of a textfile called ~/.fvwm/colorsets, which has the following in it:
4 fg white, bg aquamarine4
5 fg white, bg MediumPurple3
6 fg white, bg Orange
7 fg white, bg sandybrown
8 fg white, bg blue1
9 fg white, bg silver
10 fg white, bg cornflowerblue
They’re just standard colorsets declared in the normal way – I start at 4, as I have other colorsets defined in my fvwm2rc file already. As to how you get them in a menu, you can use the DynamicPopupAction to decide an action for a menu, as in:
DestroyMenu "FvwmMenuColorset"
AddToMenu "FvwmMenuColorset" DynamicPopupAction FuncFvwmMenuColorset
So that everytime I select the menu item above the function FuncFvwmMenuColorset is called, which will populate the menu with the colors I’d like from the file you saw above:
[code]
AddToFunc FuncFvwmMenuColorset
- I DestroyMenu recreate FvwmMenuColorset
- I PipeRead ‘echo “AddToMenu FvwmMenuColorset
Colorsets Title”’
- I PipeRead ‘echo + \“Reset\” Function ChangeStyle
“1 fg white, bg #c06077”; echo \+ \“\” Nop’
- I PipeRead ‘while read l; do echo +"${l/*bg /\ }" Function
ChangeStyle “$l”; done < ~/.fvwm/colorsets’[/code]
The final step, is to the define an action to occur when I click on an item in the menu – a means to actually change the color, hence:
DestroyFunc ChangeStyle
AddToFunc ChangeStyle
+ I ColorSet $*
+ I Style * HilightColorSet $*
+ I SetEnv DefCS "$0 $*"
+ I UpdateStyles
There’s some – dynamic menus are where I’d start looking, as well at fvwm-themes.
– Thomas Adam