I want to be able to change window styles, save them at the same time and use them when applications restarts.
The following does that: toggles Borders, Button X, and adds/removes !Borders, !Button X from the styles file.
The problem is that when I restart the program, Read command from FvwmReadStyle doesn’t work like when I restart FVWM. Works only for styles with “!StyleOption”.
Note that WindowStyle internally uses the windowid of the window to apply the style. When you restart, the window is recaptured and the style for the toplevel window is lost, hence why it’s not working for you.
So rather than giving you idea of a solution, perhaps you’ll tell me what the problem is you’re trying to solve?
Why?
Sure, I can set a style for each application window, but I want to do it from a window options menu. Styles like: !Button, !Borders, StartsOnPage, TitleAt, PositionPlacement.
With the functions above I can restyle the window, I can show/hide buttons/borders, change TitleAt, StartsOnPage, etc and save the options for each application. The problem is when I restart the application.
For example:
At FVWM start I have no style set for urxvt,
then I restyle using the window options menu:
Style "URxvt" !Button 4, !Button 6, TitleAtLeft
If I restart urxvt, the style is fine.
Then I restyle it again and enable min and max buttons, the script removes !Button 4 and !Button 6:
Style "URxvt" TitleAtLeft
If I restart urxvt, the style is like before, no min and max buttons.
I thought “Read” sets buttons, borders, etc to default, like when FVWM starts.
Like I just told you, using WindowStyle is fine, but can never persist across reboots. The only thing I can suggest is using the “State” condition on the window, and then reapply styles based on that.
When I start an application, FvwmReadStyle reads the styles file and sets the window style.
Then I can change window style from window’s options menu, style which will be applied to the window and saved to the styles file with the FvwmStyleGen function.
If I restart the application FvwmReadStyle reads the style file again and applies the new style.