Subject: FVWM: Piperead vs. Exec

From: Neil Zanella <[email-masked]>
Date: Thu, 4 May 2000 18:10:15 -0230 (NDT)

Hello,

I cannot see that Piperead would be any more useful than Exec.
Could anyone give me an example of a useful Piperead command
that cannot be implemented as an Exec command?

Thanks,

Neil Zanella
[email-masked]

--
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: Michael Han <[email-masked]>
Date: Thu, 04 May 2000 14:44:49 -0700

Previously from Neil Zanella
>that cannot be implemented as an Exec command?

FVWM listens for commands on the stdout of the PipeRead command. So
you can use powerful scripting tools like perl or python to do
intelligent things with PipeRead. With Exec, you're fundamentally
limited to what FVWM knows how to do (FVWM doesn't internally support
iterative constructs, conditional clauses, etc.). You'd never be able
to implement something like fvwm-menu-directory without PipeRead.
-- 
[email-masked]                         http://www.best.com/~mikehan/
coffee achiever                              San Francisco, California
"How can someone with glasses that thick be so stupid?" - Bart
--
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: Mikhael Goikhman <[email-masked]>
Date: Fri, 5 May 2000 01:00:01 +0300

> that cannot be implemented as an Exec command?

PipeRead and Exec are totally different commands, although they both start
shell commands. Exec is non-blocking, i.e. fvwm continues to run following
commands immideately without worrying about launched applications, it is
ideal for launching X applications. Contrary, PipeRead is blocking, i.e.
it waits until its shell command is finished *and* in addition executes
its standard output, as if it is fvwm native commands.

Examples (the second is for 2.3 versions, see fvwm-menu-xlock man page):

  PipeRead `echo "All ($USER@$HOST) Iconify"`
  PipeRead 'fvwm-menu-xlock --name MenuXLock --title "Lock Screen"'

Regards,
Mikhael.

---

From: Tim Phipps <[email-masked]>
Date: Fri, 05 May 2000 16:15:50 +0100

> that cannot be implemented as an Exec command?

/////// shell script called fvwmresizemove ///////

#!/home/tim/SunOS/bin/bash
# script to animate window reposition
# for use by fvwm only
# usage: $0 <windowid> new_width new_height new_x new_y border_width
title_height
# new_things have a `p' on the end which should be removed
id=$1; nw=${2%p}; nh=${3%p}; nx=${4%p}; ny=${5%p}; bw=$6; th=$7
nw=$((nw + 2 * bw))
nh=$((nh + 2 * bw + th))
xwininfo -id $id | {
  read z; read z; read z
  read z z z ox
  read z z z oy
  read z; read z
  read z ow
  read z oh
  ox=$((ox - bw))
  oy=$((oy - bw - th))
  ow=$((ow + 2 * bw))
  oh=$((oh + 2 * bw + th))

  echo "SendToModule FvwmAnimate animate $ox $oy $ow $oh $nx $ny $nw
$nh"
}

//// fvwm function ////

AddToFunc my_resizemove I PipeRead "fvwmresizemove $w $0 $1 $2 $3 5 17"
+                       I ResizeMove $0 $1 $2 $3

AddToFunc my_topleft    I my_resizemove 566p 376p 0p 0p
AddToFunc my_topmid     I my_resizemove 566p 376p 288p 0p
AddToFunc my_topright   I my_resizemove 566p 376p 576p 0p
AddToFunc my_midleft    I my_resizemove 566p 780p 0p 0p
AddToFunc my_midmid     I my_resizemove 566p 780p 288p 0p
AddToFunc my_midright   I my_resizemove 566p 780p 576p 0p
AddToFunc my_botleft    I my_resizemove 566p 376p 0p 403p
AddToFunc my_botmid     I my_resizemove 566p 376p 288p 403p
AddToFunc my_botright   I my_resizemove 566p 376p 576p 403p
Key KP_7        WTSF    M       my_topleft
Key KP_8        WTSF    M       my_topmid
Key KP_9        WTSF    M       my_topright
Key KP_4        WTSF    M       my_midleft
Key KP_5        WTSF    M       my_midmid
Key KP_6        WTSF    M       my_midright
Key KP_1        WTSF    M       my_botleft
Key KP_2        WTSF    M       my_botmid
Key KP_3        WTSF    M       my_botright

////////

I bind the numeric key pads to call my_resizemove so that I can tile
windows easily. The piperead script makes FvwmAnimate draw an animation
of where the window is going to. Using an Exec would mean the animation
happening some indeterminate amount of time _after_ the ResizeMove (not
cool).

I have a similar one for closing windows which animates from the window
frame down to a tiny dot, just like when you switch off an old TV.

Cheers,
Tim.