Thumbnail and the *order* problem

I find the Thumbnail function in this forum and it’s working pretty well if each window is iconified one by one. The problem comes when I use Win+D to iconify all the windows. The order in which icons appear is different from that in the .thumbnail log file. Then I cannot use the number to deiconify. Is there a way to enforce the the accordance of these two orders?

DestroyFunc Thumbnail
AddToFunc Thumbnail
+ I PipeRead "echo $[w.id]=$[w.iconfile] >> $[FVWM_USERDIR]/.thumbnail"
+ I Raise
+ I ThisWindow (!Shaded, Iconifiable, !Iconic) PipeRead "$[fvwm_scripts]/thumb $[w.id] $[fvwm_thumbnail_size] $[fvwm_tmp]/icon.tmp.$[w.id].png $[w.iconfile]"
+ I Iconify

DestroyFunc DethumbnailByNumber
AddToFunc DethumbnailByNumber
+ I PipeRead `echo WindowId $$(sed -ne '$$0s/=.*//p' $[FVWM_USERDIR]/.thumbnail) DeiconifyAndRearrange

AddToFunc DeiconifyAndRearrange
+ I Iconify off
+ I All (CurrentPage, Iconic) PlaceAgain Icon

Key 1   A   4   DethumbnailByNumber 1
Key 2   A   4   DethumbnailByNumber 2
Key 3   A   4   DethumbnailByNumber 3
Key 4   A   4   DethumbnailByNumber 4
Key 5   A   4   DethumbnailByNumber 5
Key 6   A   4   DethumbnailByNumber 6
Key 7   A   4   DethumbnailByNumber 7

Key D   A   4   All (AcceptsFocus CurrentPage !Iconic !Shaded) Thumbnail

For example, it may occur that .thumbnail is

0x1e00005=~/.fvwm/icons/firefox.png
0x1c00004=~/.fvwm/icons/terminal.png

while the first icon on the desktop is the terminal not firefox.

I remember when I wrote most of that function.

There’s no way to reliably ensure ordering, no. At best you can wrap the entire function call inside PipeRead I suppose.

– Thomas Adam

OK, may be we need not to ensure ordering if there is a way to obtain wid corresponding to the first, second, …, icon on the desktop. Can this been done in fvwm?

Sorry, I don’t understand your ‘wrap the entire function …’ part. What does that mean exactly?

Thank you.