[SOLVED]Having trouble with the Thumbnailer Fn from the Wiki

Hi,

well, I’m winning now - thanks for all the initial help - I have a very attractive and comfortable wm being tailored to my exact requirements :slight_smile: really happy and loving FVWM…

I got to the point where I want some of those really cool thumbnails and after trying Tavis’ config function as a cut and paste with some variable tuning (and another from searching the forum) I found they either didn’t work or broke everything. (Naturally right? :slight_smile: )

So… I have tried to implement the wiki thumbnailer - seems very simple and should work straight out… But it doesn’t for me; the thumbnails seem to be being written to the .fvwm directory but I am not seeing them…

wparker@geko ~/.fvwm $ ls config icon.tmp.0x1c00002.xwd icon.tmp.0x1e00040.xwd working icon.tmp.0x1c00002.png icon.tmp.0x1e00040.png resources wparker@geko ~/.fvwm $

The relevant bits of my config are:

Mouse 1 1 N Close
Mouse 1 4 N Thumbnail
Mouse 1 2 N Maximize
Mouse 2 T N Menu FvwmMenu
Mouse 2 R A WindowList SortByClass MaxLabelWidth 60
...

...
DestroyFunc Thumbnail
AddToFunc Thumbnail
+ I Raise
+ I Piperead "xwd -silent -id $[w.id] > $[HOME]/.fvwm/icon.tmp.$[w.id].xwd"
+ I Iconify
+ I Exec exec nice -n 19 convert -resize 64x64 -frame 1x1 -mattecolor black \
  -quality 0 xwd:$[HOME]/.fvwm/icon.tmp.$[w.id].xwd png:$[HOME]/.fvwm/icon.tmp.$[w.id].png ; \
   rm $[HOME]/.fvwm/icon.tmp.$[w.id].xwd ;\
   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

As you can see the main body above is the wiki code and I changed the iconify mouse binding to Thumbnail and yet all I get is the icon (I commented out the Style * NoIcon that is in Fortune’s tutorial in case that was causing it)…

Some pointers would be appreciated - including a request for the right sort of trouble shooting info - BTW there are no errors in the terminal that I launched X from…

All the best,
Will

Nope, but then that’s only PEBCAK.

(For which you mean the thumbnail function from the fvwmwiki as opposed to a function that creates ‘wiki thumbnails’).

I’ve fixed that function, and will commit the update to the fvwmwiki in a moment. Here’s the correct thumbnail function to use:

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

Whomever wrote the original failed to realise that commands are asynchronous with respect to one another. The use of ‘FvwmCommand’ during the Exec stage of the function is massively superfluous, given that one can just operate on the window in context (via ‘‘ThisWindow’’) on a separate clause.

– Thomas Adam

Thanks Thomas, I have ammended the function and can see that once again two images are being generated on thumbnail/iconify in my .fvwm directory and one is a full size state shot and one is a thumbnail; however I am still only getting the icon posted in the top left of the screen. Surely I am missing some critical part of implementing this - do I need some function to display the thumb ?

wparker@geko ~/.fvwm $ ls
config  icon.tmp.0x1c00040.png  icon.tmp.0x1c00040.xwd  resources  working

The above was a list after I removed all previous icon* and then iconified firefox. Note that I do not have NoIcon set and have not yet learnt how to do de-iconify from icons since Fortune’s tutorial uses the NoIcon at the stage I am up to to preserve desktop space and because they are not set to do anything. So All I have is the window menu options and de-iconify from the task bar.

Cheers,
Will

What do you mean? Can you be more specific, perhaps with a screenshot?

No – the thumbnail function does just that – it sets the icon of the window to use the thumbnail – by iconifing the window, you are showing it.

Well, for removing the icons, you should find a corresponding dethumbnail function which you can call on FvwmEvent, as in:

[code]DestroyModuleConfig FE-dt: *
*FE-dt: Cmd Function
*FE-dt: deiconify dethumbnail

Module FvwmEvent FE-dt
[/code]

I assume that you’ve currently got the actual thumbnail script bound to a button on the decor? If not, you could quite easily add it as an ‘iconify’ event action as a separate clause to the FvwmEvent config, shown above.

– Thomas Adam

What a classic - I went to do a screenshot of the Firefox icon sitting in the top left of the screen and it thumbnailed! So, wondering what might have caused it I did an iconify of my terminal and it iconified as only the text bar name - no thumb or icon. However after de-iconifying it from the task bar and re iconifying it I did get a thumb - so it looks like I might be only getting the right behaviour on the second attempt.

To help clarify here are some screen grabs:

  1. On my top left desktop I have minimised my firefox page as described above (ie it had already been an icon only and not a thumbnail - which prompted my initial reply since implementing your amended function and restarting fvwm) and below is a terminal that has also been into a label only icon and then on the second minimisation done a correct thumb - but notice that thunderbird which had not been minimised before has gone to icon only!

  1. On another desktop panel (after restarting fvwm individually on that screen to be sure) I minimised XV and a terminal for the first time:

  1. And then reminimised XV and the terminal

  1. Back on the original page I find that Firefox and Terminal are happy to thumbnail; as is Thunderbird now!

So while it is working I am not sure why it is working this way.

I will like to add it as an iconify event once I have worked that bit out. I have currently got it bound to the title bar iconify button:

Mouse 1 1 N Close
Mouse 1 4 N Thumbnail
Mouse 1 2 N Maximize
Mouse 2 T N Menu FvwmMenu
Mouse 2 R A WindowList SortByClass MaxLabelWidth 60

Will

It’s probably a synchronisation issue. Try this variation:

DestroyFunc Thumbnail
AddToFunc Thumbnail
+ I Raise
+ I Piperead "xwd -silent -id $[w.id] > $[FVWM_USERDIR]/icon.tmp.$[w.id].xwd"
+ I Iconify
+ I PipeRead `nice -n 19 convert -resize 64x64 -frame 1x1 -mattecolor black \
 -quality 0 xwd:$[FVWM_USERDIR]/icon.tmp.$[w.id].xwd png:$[FVWM_USERDIR]/icon.tmp.$[w.id].png; rm $[HOME]/.fvwm/icon.tmp.$[w.id].xwd`
+ I ThisWindow WindowStyle IconOverride, Icon $[FVWM_USERDIR]/icon.tmp.$[w.id].png, StaysOnBottom

The PipeRead ensures an adequate delay.

– Thomas Adam

Fantastic Thomas, that seems to do the trick; thanks very much :slight_smile:

Will

As an interesting adjunct to this exercise I have discovered the following behaviour of windows thumbnail-iconified this way…

Having just added:

Mouse 1 3 N WindowShade

...

Style "*" WindowShadeShrinks,   \
        WindowShadeSteps 20,    \
        WindowShadeLazy

I find that when I shade and unshade windows all is well and as expected; however when I shade and then iconify/thumbnail the window things seem to go abit wierd:

  1. I take a window and shade and unshade it and everything is normal
  2. I take the same window and shade it and iconify it - I get either a grab of the root window (with root-tail you can see - or I get just the text of the iconified state):

  1. I de-iconify a shaded window and get the following:

and then

Which is the behaviour that prompted my wanting to post…

A classic example and the first grab of the problem.
Then I shade and unshade (and then iconify and deiconify if I like and all is well again…)

Happens when I move the window between desktops etc too.

Any thoughts on this?

Will

I suggest using a WindowShadeShrink size of ‘0’, quite frankly. The animation you get from it, in consideration of you using s thumbnail generator is useless.

Yes – the problem here is that the Thumbnail function attempts to deshade the window. However, because of the timing of the function in relation to the deshading, the window will either be snapshotted during scrolls (if you have a WindowShadeStep size > 0, hence why I suggest you disable it), or you’ll get the root window just before the said window has finished exposing itself.

The workaround? Quite simple really. At the beginning of the function, check to see if a window is shaded. If it is deshade it, and schedule the next action within the function to be offset by a delay, such that the window is visible before the snapshot is taken. Hence:

DestroyFunc Thumbnail
AddToFunc Thumbnail 
+ I ThisWindow (Shaded) WindowShade toggle
+ I Schedule 800 Raise
+ I Piperead "xwd -silent -id $[w.id] > $[FVWM_USERDIR]/icon.tmp.$[w.id].xwd"
+ I Iconify
+ I PipeRead `nice -n 19 convert -resize 64x64 -frame 1x1 -mattecolor black \
 -quality 0 xwd:$[FVWM_USERDIR]/icon.tmp.$[w.id].xwd png:$[FVWM_USERDIR]/icon.tmp.$[w.id].png; rm $[HOME]/.fvwm/icon.tmp.$[w.id].xwd`
+ I ThisWindow WindowStyle IconOverride, Icon $[FVWM_USERDIR]/icon.tmp.$[w.id].png, StaysOnBottom

It’s worth noting that you’re also going to experience some other oddities with that function – even with the corrections above. Consider what happens if the Thumbnail function runs on an iconic window, or what if the window cannot be iconified? If you’re using FVWM 2.5.x, you can also add something like this to the function:

DestroyFunc Thumbnail
AddToFunc Thumbnail
+ I ThisWindow (Shaded) WindowShade toggle
[...]
+ I ThisWindow (Iconifiable, !Iconic) PipeRead `nice -n 19 convert -resize 64x64 [....]`
[....]

– Thomas Adam

Thomas, you have again prevailed. :slight_smile:

Thank you; it works well.

As for the other issues I am likely to experience I am using 2.15.12 (gentoo ebuild) and not able to grok your suggestion just yet but I will in time - thanks mate,
Will

Some of the suggestions were 2.5.X specific. For instance, the ‘Iconifiable’ condition is only available in the 2.5.X release of FVWM.

Note 2.5.12 is rather old – I suggest upgrading to 2.5.16

– Thomas Adam

I will take your advice and upgrade - should I unmerge the gentoo implementation and do a manual install from the source?

Further to this topic I have discovered something that can happen when thumbnailing and I think it is to do with synchronisation once again.

If I wish to iconify for example a browser window that is rather large and I move to do that from a window in the foreground and click the iconify button before the auto raise brings the window to the front then I get a thumbnail that superimposes the foreground window over the window that is being iconified. I suspected this was something to do with Raising (much as you fixed the shade/unshade issue) and yet I changed the numbers set with the Raise Schedule but couldn’t effect any difference.

It seems that the function must unshade (if shaded) and fully raise before actioning the thumbnail.

Best Regards,
Will

You’ll find an appropriate ebuild for 2.5.16 already.

Hmm. Not using these thumbnail functions, means I am doing all of this blind. It shouldn’t be an issue. If it is, then after the line in your function that looks like:

+ I Raise

Try adding:

+ I ThisWindow (OverLapped) Raise

(You’ll need 2.5.16 for this – I recommend it).

– Thomas Adam