Startup not doing everything?

Hi!

Below is a (simplified) portion of my StartFunction

AddToFunc StartFunction
+ I Exec exec resize egg.jpg wp.png
+ I Exec exec fvwm-root -r wp.png

The first line resizes egg.jpg and outputs wp.png. The second line makes that a wallpaper. The problem is that it doesn’t work every time I start X window or restart it. To make it work allways I first have to comment out only the second line and restart -> that only resizes the wallpaper and saves the image. Then I comment out only the first line and restart again -> that only initializes the wallpaper. What might be the problem here?

Is there a way to see fvwm debug info anywhere? Why doesn’t the second line alter the wallpaper if the resizing is being done at the same time? Could there be a situation where the lines are accessing the same file simultaneously and problems arise?

Any help is appreciated!

When fvwm runs an Exec command it won’t wait for the command to finish before continuing the functions. To do what you want to do yuo could try

AddToFunc StartFunction
+ I Exec exec resize egg.jpg wp.png && fvwm-root -r wp.png 

or something similar.

Thanks for you help but that didn’t seem to work. But I finally figured I had to use PipeRead like this:

AddToFunc StartFunction
PipeRead resize...
PipeRead fvwm-root...

Anyone, please correct if that is still a wrong way to do it. I think it now waits after the command has been executed completely. The above at least seemed to finally produce the desired outcome!

This fvwm is definitely not so easy beast to tame but step by step I’m gaining some knowledge thanks to this forum! I wish there were even more users contributing - maybe some day :slight_smile:

The 2nd exec replaces the shell and fvwm-root will never run. It’s like runnig “exec true” in your xterm… You want:

AddToFunc StartFunction
+ I Exec resize egg.jpg wp.png && fvwm-root -r wp.png 

That was what I meant by something similar. I’ve not been using it a lot, so I didn’t really know the exact flow it would take, and didn’t bother to think about what it really would do.

You really don’t want to use PipeRead when you don’t have to. If commands produce output that will potentially do bad stuff.

That worked equally well, thank you!

OT: Next I have to start to figure out to properly rearrange thumbnails. Now everything that can be seen (wallpaper) through a partially transcluent thumbnail get’s copied to a new location. Obviously the alpha blending should be redone there. Situation gets corrected if I “paint” over the thumbnail with a window… Time for testing and learning. [sigh] :slight_smile:

Yes, but this will happen every time FVWM loads, regardless of init or a restart. So I would probably do:

AddToFunc StartFunction
+ I Test (Init) Exec resize foo.jpg wp.png
+ I Exec exec fvwm-root -r wp.png

That way, you save having to always resize the image. (I would also have used ‘convert’ here, as there appears to be no resize dimensions anywhere in the above example.)

– Thomas Adam

The original example was really a simplified version. I’ve learnt that providing a minimal example usually yields better responses than posting many pages of code :slight_smile:

In reality I let FVWM report the desktop dimensions to the resizer so the wallpaper size will always be correct. And I also want it to scale the image whenever the resolution is changed. (I don’t know how to change resolution on the fly besides editing xorg.conf but that is another matter :wink:

BTW is there any functional differences between using Test (Init) and using InitFunction? (Besides that InitFunction is executed after StartFunction)

Yes – the use of InitFunction is generally considered deprecated now. StartFunction with (init) is what should be used.

– Thomas Adam

Take a look at xrandr if your system can support it.
Then you could probably write a function that would call xrandr to do the resolution change, then call your resize, and fvwm-root again.

Or use ‘gvidm’.

– Thomas Adam