Re: FVWM: Variable assignment and use

From: Mikhael Goikhman <migo_at_homemail.com>
Date: Tue, 29 Jun 2004 15:10:52 +0000

On 29 Jun 2004 13:43:54 +0200, Dominik Vogt wrote:
>
> Looping over all aray indices can be done with a shell script via
> piperead.
>
> # Warning: These function can *not* handle quoting characters or
> # shell meta characters in variable names or contents.
>
> AddToFunc array_get
> + i piperead 'echo setenv \\"$0_val\\" \\"\\$\[$0_$1\]\\"'

I am not sure poluting the environment space of all fvwm processes is the
best solution. An arguably faster, cleaner and easier solution is to use
FvwmPerl to handle any complex data structures, like arrays of hashes.

Here is a fun example. Open some windows and type in FvwmConsole:

  FvwmPerl # run this only once
  AddToFunc eval I SendToModule FvwmPerl eval $*

  # store position of all non sticky windows on the current page
  All (!Sticky, !Iconic, CurrentPage) \
    eval push _at_a, { id => $[w.id], x => $[w.x], y => $[w.y] }

  # switch x and y coordinates of windows
  eval foreach (_at_a) { cmd("WindowId $_->{id} AnimatedMove $_->{y}p $_->{x}p") }

  # some time later, restore original position of windows
  eval foreach (_at_a) { cmd("WindowId $_->{id} AnimatedMove $_->{x}p $_->{y}p") }

  # warp to the first window if any
  eval cmd("WindowId $a[0]->{id} WarpToWindow") if _at_a

  # clean up the stored windows data
  eval _at_a = ()

See the man page and ask if you don't understand something. FvwmPerl is
good for small tasks, for longer ones it is probably easier to write you
own module. I will post a short module (script of several lines) later
today, I need to test a new WindowList tracker anyway.

Regards,
Mikhael.
--
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 - 10:13:37 BST

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