Re: FVWM: Variable assignment and use

From: Tavis Ormandy <taviso_at_sdf.lonestar.org>
Date: Tue, 29 Jun 2004 09:19:23 +0100

On Tue, Jun 29, 2004 at 02:35:05AM -0500, Rusty Phillips wrote:
> These are the big problems I can't solve:
> 1) I can't find a non-scalar assignment mechanism.

Well, you have access to shell functions with PipeRead, and there's
FvwmPerl, but apart form that I think SetEnv is the only option.

> 2) I can't find a looping mechanism that uses such an assignment
> (foreach type looping)

All (conditions) xxx

will loop through all windows, you can add an assignment for each window
that matches.

> 3) I can't find a way to return the properties of a window.

There are variables such as $[w.id], $[w.width], etc that if accessed in
the context of a window are expanded to that property.

> 4) Some Window commands don't accept a Window name or id, and will only
> use the "current" window.
>

I'm not aware of any, some commands need to run in the context of a
window, but can be prefixed with Pick, Current, WindowId, etc. I think
most commands will use the Pick mechanism if they need to be run in the
context of a window but are'nt?

> II Is there a way to get the properties from a window newly created
> with an "Exec" command (or from multiple windows created from an Exec
> command)?

yes, see #3.18 in the faq.

> I have two questions about this:
>
> I Lets say, for example, that I wanted to create a command that keeps
> track of the location of every window on the screen and restores them
> to that condition if I press that command again, while ignoring windows
> that are new or closed. Is this possible in fvwm?

How about this:

AddToFunc SavePosition I All (CurrentPage) SetEnv Position-$[w.id] "\(True\) AnimatedMove $[w.x]p $[w.y]p"
AddToFunc RestorePosition I All (CurrentPage) PipeRead "echo Test \\$\\[Position-$[w.id]\\]"

Uses a PipeRead though :) You could use FvwmEvent to UnsetEnv variables
as windows are destroyed...

I'm not sure if this needs the new Test syntax in cvs or not.

-- 
-------------------------------------
taviso_at_sdf.lonestar.org | finger me for my gpg key.
-------------------------------------------------------
--
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 majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Tue Jun 29 2004 - 03:22:08 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:56 BST