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.

Sorry for the mistake. I wrongly supposed that, being in a lubuntu forum asking for help would be enough proof that it is a Lubuntu-related question. O.K. Let’s rephrase it:
I have a laptop (intel i7, 8 GB dram, 160 GB disk, nothing to call home about)
I have installed lubuntu 20.04 on it and it works
Apart from the usual Openbox WM I would like (for reasons that are in part historical and in part to boost performance in special cases) to have MWM running on it.
I installed MWM using Synaptic (I know there are other ways by let’s keep to the simple and to the proven)
Now MWM presents up at login screen alongside with lubuntu, openbox and something else I do not remember at the moment.
When I select MWM and then I login with my password the screen doesn’t change, remains the login screen but I am in MWM as the cursor menu is MWM’s.
If I try to open a program window (p.e. command line terminal) the windows opens and works wonders, very fast and sleek.
But when I move/resize/close it the old fragments of the windows remain there and the display starts looking weird.
I have discovered that clearing the screen with xsetroot make it all works (p.e. xsetroot -solid gold)
After the xsetroot the system is completely fine and working as specified.
Now the question is: I need to give the command xsetroot with the correct parameters before calling the mwm executable but only before mwm execution, it won’t give problems if xsetroot would be called before openbox starting but I would like to keep it neat and tidy and do not disturb other WM execution.
That’s all, sorry for the prolixity of the question but wanted to avoid any misunderstanding.

You’ve logged in with the Motif Window Manager and no Lubuntu or LXQt tool is being used (beyond the greeter or sddm which we use in common with Kubuntu (and Ubuntu-Studio though not in 20.04).

Given your question is general Ubuntu knowledge, I’d have thought a general Ubuntu support site would make more sense. To me anyway, the only Lubuntu involvement is you used Lubuntu to install your Ubuntu base system.

I was thinking exactly that. Repeating myself: the problem is not MWM, that is working fine, the problem is that: in the cascade of commands that goes from SDDM login screen as used in Lubuntu to the start of the WM (whatever has been chosed by the user) where could I put a command that should be activated when I start MWM and nowhere else?
It seems to me a specific Lubuntu question, it is not about MWM nor generally into SDDM, the question is specific for the SDDM implementation under Lubuntu 20.04.
Anyway, if you do not think so I have no problem in presenting it to the general Ubuntu forum, I simply believed that the Lubuntu people could be more informed about their SDDM implementation.