On Thu, Aug 12, 2004 at 09:10:10PM +0200, David Vilar wrote:
> Hi,
> 
> I'm trying to define a function for shading a window and sorting the
> shaded windows in the current page according to their width. For
> this I write the width and the windowId of each shaded window into a
> temporary file and I process it with a small python script. The
> result is something like
> 
> DestroyFunc ShadeWindowAndSort
> AddToFunc ShadeWindowAndSort
> + I Current WindowShade
> + I SortShadedWindows
> 
> DestroyFunc SortShadedWindows
> AddToFunc SortShadedWindows
> + I All (CurrentPage, Shaded, !Sticky) PipeRead 'echo $[w.width] $[w.id] >> 
> .fvwm/shadedWindows'
> + I PipeRead '.fvwm/sortShadedWindows.py'
> + I PipeRead 'rm -f .fvwm/shadedWindows'

The quoting is incorrect.  Variables are expanded every time a
command is run (except if it is the "AddTo..." or "+" command).
It seems you are running the ShadeWindowAndSort function in a
window context, for example with

  Current ShadeWindowAndSort

Now, this processes the command "All ( ... echo $[w.width] ..."
Variables are expanded. Because a context window is currently
defined, $[w.width] and $[w.id] are expanded, and the values of
the *current* window are inserted.

Finally, the command "Piperead 'echo <current width> <current id> >> ...'"
is run, which is what you see.  Note that the function does work
if it's run without a context window.  In this case, the
$[w.width] is not expanded before the All command.

To make it short, replace "$[w.width] $[w.id]" with
"$$$[w.width] $$$[w.id]" and the function works fine.

> (I use PipeRead instead of Exec in the 1st and 3rd lines for
> synchronizing). If I call SortShadedWindows from the Console it all
> works flawlessly, but when called from ShadeWindowAndSort it only
> moves the current window. By looking into .fvwm/shadedWindows I see
> that all the entries have the windowId (and width) of the current
> window. As I understand the 'All (...)' command this shouldn't be
> the case, or am I doing something wrong? (fvwm version is 2.5.10)
> 
> Thank you for your help!!

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]

Attachment: pgpBECcu72eEq.pgp
Description: PGP signature

Reply via email to