Executing program before calling window manager (mwm)

Hello to everyone.
I am using the 20.04.2 LTS and works wonders I am just having a small problem with the change of window manager.
I installed Mwm and shows up in the login page but when I select it and login the screen isn’t cleared and the window on screen aren’t updated, i.e. if a move a window a copy ot it remains in the previous position, the old window is only a glyph, I cannot interact with it but it remains there anyway.
After a few tests I discovered that clearing the screen once in Mwm made it work (I used: xsetroot -solid navy) so my question is: how do I execute a command before a specific WM is started?

Sorry to have to reply to my own question but forgot to add that, if at all possible, I am looking for a clean solution; for example: changing the mwm executable to call a program and then run the original mwm is a sure solution but it is not portable and cannot be maintaned.

It’s likely that mwm doesn’t deal with the background and it’s up to you to get up a program to do that. That’s not unusual (the norm in fact).

Lubuntu has pcmanfm-qt to handle the background (openbox doesn’t), just like pcmanfm did back in the LXDE days.

I’ve no experience with mwm sorry; it’s not a Lubuntu supported package.

Also being Motif, it’s also really old… so even those that used in the 90s may not remember much; I’ve got a Motif programming book behind me, it’s copyright 1992. Most of us moved on to GTK and then Qt.

FYI: You didn’t mention Lubuntu/LXQt at all; and given the really old nature of Motif (predating Qt or GTK+) I get the feeling you’re not a Lubuntu user at all, but added it to a server install, thus the off-topic move.

The only references I can see to online that aren’t very old relate to use on giving a simple X to servers on sites that aren’t very knowledgeable/helpful anyway in my opinion.

If you’re trying to use Lubuntu using mwm instead of openbox please let me know, and I’ll install it myself & look again - but it doesn’t seem very efficient to me, and I’m not sure you’ll gain anything. It would work though I believe.