I am always not clear about how to specify the target of a FVWM command, so I think it’s time to ask this question and clear up the concept: i.e. for example, when I say
which window will be Iconified??
this is easy if you Iconify it by pressing a button on the window border,
or when you invoke it by key-binding, that should be the window with the current focus.
but I have this function:
I Exec xterm
so I want to create an xterm and maximize it, instead, the old window on which the pointer hangs is maximized, how can I let the new window be maximized?
further more, is it possible to let the Exec return a window id and use that id in the maximize command?
It depends upon the context that you call the command from, as to its default behaviour.
Not necessarily with the current -focus- – but as you have observed, it runs within a window context which is why when you write functions that act on windows directly – say via key bindings or mouse bindings, you can write:
+ I Iconify
It’s implicitly being called within a window operand, so FVWM knows which window you’re talking about. If it was indirect, you would have to qualify that as in the use of ThisWindow:
+ I ThisWindow Iconify
The problem you’re having here is that you’re assuming the “Maximize” command applies to the Xterm window created. That’s not true. The lifespan of the function as you have it there acts upon the operand context for the duration of that function. What you really want to do is something like this:
+ I Exec xterm -T myXterm
+ I Wait myXterm
+ I Next (myXterm) Maximize
Notice what’s happening here – the function waits for the window called “myXterm” to be created, and once it has, for the conditional command “Next” to perform the Maximize command on the specified window.
It is, but wholly inappropriate given the mechanism abvove. If you want further examples and/or explanations, see the following: