There’s your button. In order for that button to inherit the necessary properties, you can use FvwmEvent with the focus_change event. Hence:
DestroyModuleConfig FE: *
*FE: Cmd Function
*FE: focus_change updateButton
Module FvwmEvent FE
Each time there’s a change in focus, that event will get called, which in turn will call the updateButton function. It’s this function which will do all the work for us.
DestroyFunc updateButton
AddToFunc updateButton
+ I Current SendToModule FB ChangeButton MyButton Title $[w.name]
+ I Current SendToModule FB ChangeButton MyButton Icon $[w.miniiconfile]
So all that does is it changes both parts of the button – the title and the icon, depending on which window has the focus. As a test case, here’s what I did: