Thumbnailing and the real icon

Hello

I usually use the taviso’s thumbnail function:

[code]DestroyFunc Thumbnail
AddToFunc Thumbnail

  • I Raise
  • I ThisWindow (!Iconic) SetEnv Icon-$[w.id] $[w.iconfile]
  • I ThisWindow (!Shaded, Iconifiable, !Iconic) PipeRead
    “xwd -silent -id $[w.id] | convert -scale 128 -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 TestRc (Match) Test (f $[w.miniiconfile], f $[FVWM_USERDIR]/icon.tmp.$[w.id].png) PipeRead
    “composite -geometry +2+4 $[w.miniiconfile] $[FVWM_USERDIR]/icon.tmp.$[w.id].png
    $[FVWM_USERDIR]/icon.tmp.$[w.id].png; echo Nop”
  • I Iconify

DestroyFunc DeThumbnail
AddToFunc DeThumbnail

  • I PipeRead “echo Test \(i \$\[Icon-$[w.id]\]\) WindowStyle Icon \$\[Icon-$[w.id]\]”
  • I TestRc (NoMatch) WindowStyle NoIconOverride, Icon
  • I Exec rm -f $[FVWM_USERDIR]/icon.tmp.$[w.id].png
  • I All (Iconic, CurrentPage) PlaceAgain icon
  • I UnsetEnv Icon-$[w.id][/code]

but there is a problem with this one: if you have defined a special Icon for the application using IconOverride and you have thumbnailed the window once, when you try to iconify it, then the default Icon is used and not the one defined by IconOverride.

I tried different hacks to solve this and get back the icon I defined when iconifying the application but I couldn’t solve it.

The way to do that is I think to store the Icon path in a variable and during dethumbnailing to do an “echo Style this_app IconOverride, Icon the_file” but I was not able to find the way of doing so…

If someone has an idea, it is welcome!!

Best regards, Brice

I suspect what’s happening is that by the time the window is iconified, it’s too late for the icon to be assigned to the window. I doubt there’s a way around this, though.

Your email to the fvwm mailing-list might prove me wrong, though.

– Thomas Adam

this is definitively strange as the first iconification works well but no the followings!

This SetEnv looks also strange to me as you can check what’s going on here…

Let’s wait for the mailing list see if something comes out!

Brice

Removing:

+ I UnsetEnv Icon-$[w.id]

seems to do the trick! The other way is to use DestroyWindowStyle but it let some window flicker when they are dethumbnailed (i.e. acroread)

Brice

ps: does someone know how to visualize the environment variables set with SetEnv ?

Well, that should have been in the original scripts, anyway. So something is wrong there.

They’re exported into the environment space by FVWM. So a PipeRead would do.

– Thomas Adam

What do you mean by “something is wrong here” Thomas? taht my trick is ugly or what?

Humm concerning the Piperead I don’t see how to get that from a console…

Brice

No no, not at all. All I meant was that I was sure the solution you found was already present in a lot of the different versions of thumbnail functions available – mind you, if there are lots of versions, changes are probable.

It’s symptomatic of the following:

viewtopic.php?t=387

If you wanted a list of all environment variables exported via the FVWM process, then you would have to know the names of the variables beforehand. Is that what you’re asking? :slight_smile: You can use “env” to see a list of all exported env vars, mind.

– Thomas Adam

Ok thanks Thomas!

The main problem with my functions is that at the end of the day you have a full-list of environment variables all around… not so funny.

So I implemented a small “MyClose Function”, the full stuff is here:

DestroyFunc	Thumbnail
AddToFunc	Thumbnail
+ I Raise
+ I State 4 true
+ I SetEnv Icon-$[w.id] $[w.iconfile]
+ I ThisWindow (!Shaded, Iconifiable, !Iconic) PipeRead \
    "/$[fvwm_scripts]/thumb $[w.id] $[fvwm_icon_size] /dev/shm/icon.tmp.$[w.id].png \
    && convert -frame 1x1 -mattecolor black /dev/shm/icon.tmp.$[w.id].png /dev/shm/icon.tmp.$[w.id].png \
    && echo WindowStyle IconOverride, Icon /dev/shm/icon.tmp.$[w.id].png || echo Nop"
+ I TestRc (Match) Test (f $[w.miniiconfile], f /dev/shm/icon.tmp.$[w.id].png) PipeRead \
    "composite -geometry +5+8 $[w.miniiconfile] /dev/shm/icon.tmp.$[w.id].png \
    /dev/shm/icon.tmp.$[w.id].png; echo Nop"
+ I Schedule 150 Iconify

DestroyFunc	DeThumbnail
AddToFunc	DeThumbnail
+ I PipeRead "echo WindowStyle IconOverride, Icon \\$\\[Icon-$[w.id]\\]"
+ I Exec rm -f /dev/shm/icon.tmp.$[w.id].png
+ I All (Iconic, CurrentPage) PlaceAgain icon

DestroyFunc MyClose
AddToFunc MyClose
+ I Current (State 4) UnsetEnv Icon-$[w.id]
+ I State 4 false
+ I Close
+ I All (Iconic, CurrentPage) PlaceAgain icon

The removal of the environment variable seems to work fine but if I close a window in its thumbnailed state, the “PlaceAgain icon” is not executed… I don’t see why, maybe someone does?

Best regards, Brice

ps: I said the removal of the environment variable seems to work fine since after closing a window that has been thumbnailed and issuing “env|grep Icon” in a terminal doesn’t output something as before.

In fact this “PlaceAgain” is executed but to realize that a window has been closed, it needs a small delay! so

[code]DestroyFunc MyClose
AddToFunc MyClose

  • I Current (State 4) UnsetEnv Icon-$[w.id]
  • I State 4 false
  • I Close
  • I Schedule 10 All (Iconic, CurrentPage) PlaceAgain icon
    [/code]

is alright! 10 msec are enough.

Brice