DestroyFunc StartShaded
AddToFunc StartShaded
+ I Exec exec $0
+ I Wait $0
+ I Next ($0) WindowShade
Note though the limitations of doing this â in order for the above to work, youâre relying on FVWM invoking the function above in the form:
StartShaded my_application
Which is fine for things like menus and buttons in FvwmButtons â but what about if you launched this application from xterm? Youâd have to use FvwmEvent for this [1]:
DestroyModuleConfig FE:*
*FE: Cmd Function
*FE: add_window SomeFunction
Module FvwmEvent FE
As I have explained so man times elsewhere the above sets up FvwmEvent to listen for when new windows are created. The definition of SomeFunction might look like:
DestroyFunc SomeFunction
AddToFunc SomeFunction
+ I ThisWindow (some_name, !Shaded) WindowShade
This has the advantage that the event is fired irrespective of where the application was launched from. In almost all instances, you want to use the FvwmEvent example.
HTH,
â Thomas Adam
[1] I keep saying it, but FvwmEvent is so useful, and is one of the most common instances I write about here when answering questions for task-based scenarios.
Not stable, seems something else need to add.
I had some doubt of the âNext $0â within the function, so i still want to get the $[w.id]. for i want remember exactlly the window started from the âStartShadedeâ. if i got the id, i can use sth like this âSetEnv Env0 $[w.id]â and then use âWindowId $[Env0] Thumbnailâ in the future.
The reason why you get that fault is most likely because the name of the window does not match the executable â hence âgvimâ sets itself to âGVIMâ.
It is stable, you just need to re-read everything in my last post, and realise why I am telling you to use FvwmEvent.
Aww, bless you. Whyâs that? I certainly donât make this stuff up just so that people can pick and choose which pieces I might be lying about or which have a hidden meaning. :| Next ($0) does what you might think it does â it operates on the next window matching whatever â$0â might be. Since there might be a new window with this name, it will hence match that window. What made you think it wasnât necessary? Thatâs the most imporant part.
No, you really donât want to use the approach. The windowID set lasts only as long as that specific window is running. If you were to close it and reopen the same window, it would have a different windowID rendering all your useless SetEnvs useless (and utterly superfluous in thought and approach, anyway). Since you only have a specific number of windows likely youâll want to shade, Iâll again point you to FvwmEvent.
Your suggestion of something like this:
DestroyFunc StartShaded
AddToFunc StartShaded
+ I Exec exec $0
+ I WindowId $0 Focus
Doesnât even make sense â the window might not even have been mapped, plus the use of âWindowId $0â isnât passing the ID of the window at all, itâs using the name of it.
If itâs just a case of wanting to reshade a window later on then you can do something like this:
Next (some_name) WindowShade
⌠Along with any form of â!Shadedâ or âShadedâ conditions.
So we come back to the notion of my previous post realising thatFvwmEvent is the better option.
Your calling it âStartThumbnailâ by the way is a misnomer â youâre shading a window, not iconifying it.
thanks very much for your reply. you are so kind and I learn much here. perhaps some mistaken due to my expression and my poor english.
I thought maybe i made this job more complex myself. I know FvmwEvent is very strong.
My orginal mind is lauch a âaMuleâ software and iconity(Thumbnail) it at pager 1,0(just like background load). I have a function called âThumbnailâ that works well.
I thought maybe here has a simple way to got it. directlly excute those:
Style aMule StartsOnPage 0 1
Exec amule
Next (aMule) Thumbnail
so the reason i make up a function is want to launch other software in the same way maybe in the future.