Hello list, Dominik asked if I could provide a FAQ entry about Thumbnail Icons on #fvwm earlier today, so here it is...
Feel free to edit it however you like :) Q. How can I set a screenshot as an Icon? A. You will need fvwm 2.5.8 or later, as this solution requires the WindowStyle command, and you should have the ImageMagick utililties available in your $PATH <URL:http://www.imagemagick.org/>. This function will provide a Replacement for the Iconify command called Thumbnail, which you can use in your bindings and will Raise each window take a screenshot and attempt to set the screenshot as the window's Icon. DestroyFunc Thumbnail AddToFunc Thumbnail + I Raise + I ThisWindow (!Shaded Iconifiable !Iconic) PipeRead \ "xwd -silent -id $[w.id] | convert -scale 64 -frame 1x1 \ -mattecolor black -quality 0 xwd:- png:$[FVWM_USERDIR]/icon.tmp.$[w.id].png \ && echo WindowStyle IconOverride, Icon $[FVWM_USERDIR]/icon.tmp.$[w.id].png \ || echo Nop" + I Iconify You can use FvwmEvent to remove the Icons when each window is returned to it's non Iconic state. DestroyFunc DeThumbnail AddToFunc DeThumbnail + I Exec rm -f $[FVWM_USERDIR]/icon.tmp.$[w.id].png + I DestroyWindowStyle *FvwmEvent: deiconify DeThumbnail AddToFunc StartFunction I Module FvwmEvent If you cannot use DestroyWindowStyle as you require it for some other purpose, you can save the window's current Icon, and restore it when required, this solution requires fvwm 2.5.9 or later. The Thumbnail function should look like this: DestroyFunc Thumbnail AddToFunc Thumbnail + I Raise + I SetEnv Icon-$[w.id] $[w.iconfile] + I ThisWindow (!Shaded Iconifiable !Iconic) PipeRead \ "xwd -silent -id $[w.id] | convert -scale 64 -frame 1x1 \ -mattecolor black -quality 0 xwd:- png:$[FVWM_USERDIR]/icon.tmp.$[w.id].png \ && echo WindowStyle IconOverride, Icon $[FVWM_USERDIR]/icon.tmp.$[w.id].png \ || echo Nop" + I Iconify And then the Icon is restored with this function: DestroyFunc DeThumbnail AddToFunc DeThumbnail + I PipeRead "echo WindowStyle Icon \\$\\[Icon-$[w.id]\\]" + I UnsetEnv Icon-$[w.id] + I Exec rm -f $[FVWM_USERDIR]/icon.tmp.$[w.id].png These Icons can also survive a Restart by adding this check to your StartFunction: AddToFunc StartFunction I Test (Restart) All (Iconic) \ Test (f $[FVWM_USERDIR]/icon.tmp.$[w.id].png) WindowStyle \ IconOverride, Icon $[FVWM_USERDIR]/icon.tmp.$[w.id].png You can also check for any remaining icons left behind and remove them in your ExitFunction: AddToFunc ExitFunction I Test (!ToRestart) \ Exec rm -f $[FVWM_USERDIR]/icon.tmp.* Thanks, Tavis. -- ------------------------------------- [EMAIL PROTECTED] | finger me for my gpg key. -------------------------------------------------------
pgp6bEQMXMwaj.pgp
Description: PGP signature