want get the $[w.id]

I want lauch one software when start fvwm, and let it act as shaded or thumbnail immediatelly.

like this:

Exec rox Current WindowShade

how can i get the $[w.id], so i can let the window of rox do sth.

i had test one function, but not success.

[code]DestroyFunc Start_Thumbnail
AddToFunc Start_Thumbnail

  • I Exec $0
  • I WindowId $0 WindowShade[/code]
Start_Thumbnail rox


You want something like this:

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.


– 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.

FvwmCommand ‘StartShaded gnome-search-tool’
FvwmCommand ‘StartShaded gnome-terminal’
FvwmCommand ‘StartShaded rox’

FvwmCommand ‘StartShaded gvim’
FvwmCommand ‘StartShaded gnome-calculate’
FvwmCommand ‘StartShaded nvu’

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. :expressionless: 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.

– Thomas Adam

thanks very much for your reply. :laughing: you are so kind and I learn much here. perhaps some mistaken due to my expression and my poor english. :stuck_out_tongue:

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.

Well, yes. Again, note that in my original post, I did say you can chain a list of windows together that you would like shaded, as in:

+ I ThisWindow("aMule|GVIM|SomeOtherWindow") WindowShade

The “|” means “or” in this case.

– Thomas Adam