Subject: FVWM: letting fvwm do something in the background

From: Klaus Umbach <[email-masked]>
Date: Sat, 10 Jan 2004 17:05:05 +0100

Hello list,
is it possible, to let fvwm do something in the background?
With the help of Tavis Ormandy, I have a nice function now, to have
a thumbnail of an iconified window for the icon. It really looks
beautiful, but it takes some time, to iconify a fullscreen-window (2-3
secs!).
While fvwm is working on that thumbnail-function, I cannot do anything,
is it possible, put it in the background, so I don't have to wait
anymore, until I can work?

regards
	Klaus
	
--
5) People say Linux is ugly. How does that make you feel?
Torvalds: They'll be the first against the wall when the revolution comes.
	  Let's see just how ugly they think it is when they have a few
	  bulletholes in them.

--
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: Dan Espen <[email-masked]>
Date: Sat, 10 Jan 2004 11:11:26 -0500

> anymore, until I can work?

Search the man page for "Schedule".

-- 
Dan Espen                           E-mail: [email-masked]

---

From: Klaus Umbach <[email-masked]>
Date: Sat, 10 Jan 2004 17:42:17 +0100

> Search the man page for "Schedule".

No, that doesn't help, I still cannot do anything while this function is
processed.

DestroyFunc Thumbnail
AddToFunc Thumbnail
+ I Raise
+ I PipeRead "xwd -silent -id $[w.id] >
$[HOME]/.fvwm/icon.tmp.$[w.id].xwd"
+ I Iconify
+ I Schedule 1000 $[w.id] PipeRead "nice -19 convert -resize 64x54 -frame 1x1 -mattecolor black -quality 0 xwd:$[HOME]/.fvwm/icon.tmp.$[w.id].xwd png:$[HOME]/.fvwm/icon.tmp.$[w.id].png && echo WindowStyle IconOverride, UseIcons, Icon $[HOME]/.fvwm/icon.tmp.$[w.id].png,StaysOnBottom || echo Nop"

---

From: Marcus Lundblad <[email-masked]>
Date: Sat, 10 Jan 2004 18:01:31 +0100 (CET)

> + I Schedule 1000 $[w.id] PipeRead "nice -19 convert -resize 64x54 -frame 1x1 -mattecolor black -quality 0 xwd:$[HOME]/.fvwm/icon.tmp.$[w.id].xwd png:$[HOME]/.fvwm/icon.tmp.$[w.id].png && echo Wind…

Try replacing "PipeRead" with "Exec".

//Marcus

---

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 10 Jan 2004 18:16:03 +0000

On 10 Jan 2004 18:01:31 +0100, Marcus Lundblad wrote:
> > + I PipeRead "xwd -silent -id $[w.id] > $[HOME]/.fvwm/icon.tmp.$[w.id].xwd"
> > + I Iconify

No, just replacing will not work here. You can't Iconify until the
screenshot is taken.

You may avoid any freeze if you use this technology:

  DestroyFunc Thumbnail
  AddToFunc   Thumbnail
  + I Raise
  + I Exec create-xwd; FvwmCommand 'WindowId $[w.id] Iconify on'; \
    create-png; FvwmCommand 'WindowId $[w.id] WindowStyle Icon icon.png'

(Just don't forget to run FvwmCommandS in StartFunction.)

But then the results are unpredictable, you may lower your window or move
it outside the screen and the snapshot will be broken. Or you may Iconify
the window for the second time by a mistake (using the same function
obviously), then you may have real troubles with files.

There is no way to prevent all these problems without locking, i.e.
you would better wait in PipeRead.

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 12 Jan 2004 09:50:36 +0100

> you would better wait in PipeRead.

But only taking the screenshot has to be done synchronously.  Try

  DestroyFunc Thumbnail
  AddToFunc Thumbnail
  + I Raise
  + I PipeRead "xwd -silent -id $[w.id] \
      > $[HOME]/.fvwm/icon.tmp.$[w.id].xwd"
  + I Iconify
  + I Exec FvwmCommand 'WindowId $[w.id] Iconify on'; \
      create-png; \
      FvwmCommand 'WindowId $[w.id] WindowStyle Icon icon.png'

Ciao

Dominik ^_^  ^_^

---

From: Mikhael Goikhman <[email-masked]>
Date: Mon, 12 Jan 2004 12:08:30 +0000

>   + I Exec FvwmCommand 'WindowId $[w.id] Iconify on'; \
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>       FvwmCommand 'WindowId $[w.id] WindowStyle Icon icon.png'

For the sake of correctness, the marked part above should be removed.
It is important to do "Iconify" in the function and not in Exec to avoid
the double-iconify-corrupts-files problem. And to hope that Exec is
finished before the user deiconifies/iconifies the window again to avoid
the same problem.

Regards,
Mikhael.

---

From: Klaus Umbach <[email-masked]>
Date: Wed, 14 Jan 2004 06:19:32 +0100

Thank you all, for helping me.

You can see the result at
http://www.stud.uni-karlsruhe.de/~ugk8/current-screenshot.jpg

It really is beautiful :-)

And here are the final(?) functions:

DestroyFunc Thumbnail
AddToFunc Thumbnail
+ I Raise
+ I Piperead "xwd -silent -id $[w.id] > $[HOME]/.fvwm/icon.tmp.$[w.id].xwd"
+ I Iconify
+ I Exec nice -19 convert -resize 64x54 -frame 1x1 -mattecolor black -quality 0 xwd:$[HOME]/.fvwm/icon.tmp.$[w.id].xwd png:$[HOME]/.fvwm/icon.tmp.$[w.id].png; FvwmCommand 'WindowId $[w.id] WindowStyle IconOverride, Icon $[HOME]/.fvwm/icon.tmp.$[w.id].png, StaysOnBottom'

DestroyFunc DeThumbnail
AddToFunc DeThumbnail
+ I DestroyWindowStyle
+ I Exec rm -f $HOME/.fvwm/icon.tmp.$[w.id].*
+ I deiconify-and-focus

Best regards
	Klaus