Re: FVWM: Window parameters and current window

From: Dominik Vogt <dominik.vogt_at_gmx.de>
Date: Thu, 26 Apr 2001 18:43:49 +0200

On Thu, Apr 26, 2001 at 10:01:36AM -0500, An Thi-Nguyen Le wrote:
> Version: 2.3.31
>
> I've read the manpage on command expansion; I want to write something
> like
>
> Function CenterWindow
> + I PipeRead 'echo Current Move $(($[vp.width]/2 - $[w.width]/2)) \
> $(($[vp.height]/2 - $[w.height]/2))'
>
> However, I don't know how to associate a window with the command.
> This merely tries to execute
>
> echo Current Move $(( 1280/2 - $[w.width] )) $(( 960/2 - $[w.height]/2 ))
>
> *even* if there *is* a current window (e.g., a window that is focused,
> not iconified, raised, etc.)

This depends very much on how you call this function:

 - If called from a mouse or key binding on a window it will have
   a window:

     mouse 3 T a CenterWindow
     key f3 T a CenterWindow
     # click on window title with button 3 to activate (or press f3)

 - If called from a mouse or key binding without a window it will
   not have an associated window:

     mouse 3 R a CenterWindow
     key f3 R a CenterWindow


 - If Invoked from a Read or PipeRead command it will have a window
   if the PipeRead/Read command had one. Thus,

     mouse 3 T a PipeRead "echo CenterWindow"

   will work, but

     mouse 3 R a PipeRead "echo CenterWindow"

   will not.

 - If called from FvwmConsole or FvwmConsole or most other modules
   it will *not* have a window.

     FvwmCommand "CenterWindow"
     FvwmCommand "PipeRead 'echo CenterWindow'"
     
   Will not work.

 - If called from FvwmEvent it depends on the *FvwmEventPassId
   option.

In your command line, the "Current" is inside the piperead. Thus,
$[w.width] and $[w.height] are not defined when the shell is
called. Therefore, the calculation can not be executed. You have
to put "Current" before the PipeRead command:

  + I Current Piperead "echo Move \
      $(( $[vp.width]/2-$[w.width]/2 ))p \
      $(( $[vp.height]/2-$[w.height]/2 ))p"

You also have to add a 'p' at the end of the numbers to tell fvwm
to use pixels as the scale for movement.

> The example in the manpage also doesn't work, and suffers from the
> same problem (if it is a problem):
>
> AddToFunc PrintDeskNumber
> + I Echo $$d $[page.nx] $c
>
> will only print something like
>
> 1 0 $c
>
> again, even if there is a current window (focused, not iconified, raised, etc).

Right, the example is incorrect.

Bye

Dominik ^_^ ^_^

--
Dominik Vogt, dominik.vogt_at_gmx.de
Reply-To: dominik.vogt_at_gmx.de
--
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 Thu Apr 26 2001 - 11:44:04 BST

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