morgant / mlvwmrc

Macintosh-like Virtual Window Manager (MLVWM) configuration files
24 stars 1 forks source link

Set default desktop pattern in themes in such a way that they can be overridden #14

Open morgant opened 2 months ago

morgant commented 2 months ago

I've recently discovered that a System 6-like black & white 'gray' desktop pattern can be easily set using xsetroot -gray, so would like this to be the default desktop pattern. Naturally, I'd want it to be set in such a way that it can be easily overridden by the user.

I think that xsetroot -gray would be a good default for the System7 theme, but would lean towards xsetroot -fg \#6f6f6f -bg \#bfbfbf -bitmap /usr/X11R6/include/X11/bitmaps/gray for the MacOS8 & MacOS9 themes.

morgant commented 2 months ago

See this Mastodon thread where I explore & demonstrate some of the options I've tried on OpenBSD.

morgant commented 2 months ago

I've taken a quick look at the MLVWM source and the following is my current understanding:

So, I believe this means that InitFunction/RestartFunction built-in commands always append to Scr.StartFunc. If correct, that should mean that each theme (e.g. .mlvwm/theme/System7) could have it's own InitFunction which has an xsetroot call to set the default X11 root window background pattern/color. If we then make sure that we're loading/inlcuding our .mlvwm/.initrc file (which contains our InitFunction block) after the theme is loaded, then it should first execute our theme-level actions followed by our general configurations, allowing users to override theme defaults (at least in terms of xsetroot calls and such).

morgant commented 2 months ago

Unfortunately, I must have missed or misunderstood something in the mlvwm source, as it appears that only the last defined InitFunction block is executed. Honestly, that's what I initially expected to find, so was feeling pleasantly surprised that it wasn't the case and -- while knocked back down -- not exactly disappointed.

So, I'll review the code again and rethink my approach, which may ultimately require changes to mlvwm itself.

morgant commented 2 months ago

Upon reviewing the MLVWM source again, specifically the implementation of SetStartFunction() in mlvwm/config.c, I believe I now understand what I missed:

I'll report this issue in the mlvwm repo as it certainly shouldn't leak memory like that and maybe should allow multiple InitFunction/RestartFunction calls to append. That said, maybe there should be separate built-in functions for creating, appending, and destroying InitFunction/RestartFunction lines/commands/shortcuts.