Subject: FVWM: Behaviour of 'All (Condition)'

From: David Vilar <[email-masked]>
Date: Thu, 12 Aug 2004 21:10:10 +0200

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'

(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!!

-- 
David Vilar Torres			RWTH Aachen
Tel: (+49) 241 80 21611			Lehrstuhl f. Informatik VI
Fax: (+49) 241 80 22219			Ahornstr. 55
[email-masked]		D-52056 Aachen (Germany)
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 12 Aug 2004 21:43:43 +0200

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

> Thank you for your help!!

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]