| 1 |
# Thumbnails |
| 2 |
# If included after Fullscreen, the icons cannot be moved |
| 3 |
|
| 4 |
SetEnv ThumbWidth 128 |
| 5 |
SetEnv ThumbHeight 128 |
| 6 |
|
| 7 |
# Icons don't have titles |
| 8 |
Style * !NoIcon |
| 9 |
Style * NoIconTitle |
| 10 |
Style * IconSize 128 128 |
| 11 |
#Style * HilightIconTitleColorset |
| 12 |
Style * IconBackgroundColorset $[infostore.cs_transparent] |
| 13 |
#Style * IconTitleRelief 0 |
| 14 |
Style * IconBackgroundRelief 0 |
| 15 |
|
| 16 |
|
| 17 |
# One of (best to worst): resize, scale, sample |
| 18 |
SetEnv ThumbQuality "resize" |
| 19 |
SetEnv ThumbBorderColor "gray" |
| 20 |
|
| 21 |
SetEnv ThumbDirectory "/tmp" |
| 22 |
|
| 23 |
#SetEnv SelectOnReleaseKey Alt_L |
| 24 |
|
| 25 |
DestroyFunc Window-Iconify |
| 26 |
AddToFunc Window-Iconify |
| 27 |
+ I Current (!Iconifiable) Break |
| 28 |
+ I CreateThumbnail |
| 29 |
|
| 30 |
# Window thumbnails can be moveable using LMB |
| 31 |
#AddToFunc Icon-Restore-CurrentDesk M Move |
| 32 |
|
| 33 |
DestroyFunc Icon-Close |
| 34 |
AddToFunc Icon-Close |
| 35 |
#+ I Nop |
| 36 |
# Keep this line for the benefit of FVWM 2.5.13 -- versions thereafer |
| 37 |
# support nested variable expansion. |
| 38 |
+ D PipeRead "echo WindowStyle Icon \\$\\[Icon-$[w.id]\\]" |
| 39 |
+ D WindowId $[w.id] Layer 0 4 |
| 40 |
+ D UnsetEnv Icon-$[w.id] |
| 41 |
+ D DestroyWindowStyle |
| 42 |
+ D Test (f $[ThumbDirectory]/icon.tmp.$[w.id].png) Exec exec rm -f $[ThumbDirectory]/icon.tmp.$[w.id].png |
| 43 |
+ D Close |
| 44 |
|
| 45 |
DestroyFunc CreateThumbnail |
| 46 |
AddToFunc CreateThumbnail |
| 47 |
+ I Raise |
| 48 |
+ I Piperead "xwd -silent -id $[w.id] > $[ThumbDirectory]/icon.tmp.$[w.id].xwd" |
| 49 |
+ I Iconify |
| 50 |
+ I State 4 true |
| 51 |
+ I State 5 true |
| 52 |
+ I PipeRead ` nice -19 convert -$[ThumbQuality] $[ThumbWidth]x$[ThumbHeight] -frame 1x1 \ |
| 53 |
-mattecolor $[ThumbBorderColor] -quality 0 \ |
| 54 |
xwd:$[ThumbDirectory]/icon.tmp.$[w.id].xwd png:$[ThumbDirectory]/icon.tmp.$[w.id].png; \ |
| 55 |
rm $[ThumbDirectory]/icon.tmp.$[w.id].xwd; test -f $[w.iconfile] && composite -compose over -geometry +5+5 \ |
| 56 |
$[w.iconfile] $[ThumbDirectory]/icon.tmp.$[w.id].png $[ThumbDirectory]/icon.tmp.$[w.id].png; \ |
| 57 |
echo 'WindowId $[w.id] WindowStyle NeverFocus, Colorset $[infostore.cs_quakeconsole], HilightColorset $[infostore.cs_quakeconsole], EWMHMiniIconOverride, IconOverride, Icon $[ThumbDirectory]/icon.tmp.$[w.id].png, MiniIcon $[ThumbDirectory]/icon.tmp.$[w.id].png'; \ |
| 58 |
echo 'WindowId $[w.id] Layer 0 2'` |
| 59 |
|
| 60 |
# {{{ Comments about RemoveThumbnail |
| 61 |
# In FVWM-Crystal thumbnails are de-iconified using "Iconify false" command. |
| 62 |
# FvwmEvent module catches this event and starts 'RemoveThumbnail' function. |
| 63 |
# Because there are two instances of FvwmEvent, we can make a double-loop and |
| 64 |
# do two things in one complex function: |
| 65 |
# How thumbnail system works: |
| 66 |
# While thumbnail is created, two States are set (4 & 5). When |
| 67 |
# 'RemoveThumbnail' is called, it does: |
| 68 |
# (first FvwmEvent instance) |
| 69 |
# - check if State 5 is set, if yes, then try to de-iconify and focus a window |
| 70 |
# (currently impossible because of the window's Styles) |
| 71 |
# - check if State 4 is set, if yes, then remove the thumbnail and reset |
| 72 |
# window's Syles |
| 73 |
# - unset State 4 |
| 74 |
# (second FvwmEvent instance) |
| 75 |
# - check if State 5 is set, if yes, then try to de-iconify and focus a window |
| 76 |
# (now doable) |
| 77 |
# - check if State 4 is set, if no, unset State 5 and break |
| 78 |
# The result is focused window after de-iconification and cleaned up thumbnail |
| 79 |
# image. }}} |
| 80 |
DestroyFunc RemoveThumbnail |
| 81 |
AddToFunc RemoveThumbnail |
| 82 |
+ I ThisWindow (!State 5) Break |
| 83 |
+ I ThisWindow DestroyWindowStyle |
| 84 |
+ I Schedule 100 WindowId $[w.id] Window-Focus-CurrentDesk |
| 85 |
+ I ThisWindow (!State 4) State 5 false |
| 86 |
+ I ThisWindow (!State 4) Break |
| 87 |
# Keep this in for the benefit of FVWM 2.5.13, although versions |
| 88 |
# thereafter have support for nested variable expansion. |
| 89 |
+ I PipeRead "echo WindowStyle Icon \\$\\[Icon-$[w.id]\\]" |
| 90 |
+ I WindowId $[w.id] Layer 0 4 |
| 91 |
+ I UnsetEnv Icon-$[w.id] |
| 92 |
+ I Test (f $[ThumbDirectory]/icon.tmp.$[w.id].png) Exec exec rm -f $[ThumbDirectory]/icon.tmp.$[w.id].png |
| 93 |
+ I State 4 false |
| 94 |
+ I Test (f $[infostore.TmpDirectory]/fullscreen.19.$[w.id].$[page.nx].$[page.ny].tmp) ThisWindow Fullscreen-Start |
| 95 |
|
| 96 |
DestroyModuleConfig FvwmEvent-Icon-Thumbnails: * |
| 97 |
*FvwmEvent-Icon-Thumbnails: deiconify RemoveThumbnail |
| 98 |
Module FvwmEvent FvwmEvent-Icon-Thumbnails |
| 99 |
|
| 100 |
# Restore the thumbnails after session restart, a delay is required to get correct icons order with the Icon-Launcher |
| 101 |
DestroyFunc RecoverThumbnails |
| 102 |
AddToFunc RecoverThumbnails |
| 103 |
+ I All Test (f $[ThumbDirectory]/icon.tmp.$[w.id].png) WindowId $[w.id] WindowStyle IconOverride, Icon $[ThumbDirectory]/icon.tmp.$[w.id].png |
| 104 |
|
| 105 |
AddToFunc StartFunction I Schedule 500 RecoverThumbnails |
| 106 |
|
| 107 |
# Icons can be moved around |
| 108 |
AddToFunc Icon-Restore-CurrentDesk M Move |
| 109 |
|
| 110 |
# vim:ft=fvwm |