Auto-resize icon to fit FvwmButton

Icon resize is a good idea?

  • Yes, a great one
  • No, i dont need it
  • I dont care

0 voters

One thing i see is missing on FVWM is an “Auto-resize to fit ?bar/?panel” function. Almost every icon downloaded exist on a hiogh res (like 256x256), and when you asign those icons to a FvwmButton it doesnt fit the button at all. You wind up having to change its res to whatever you want. But that can be a pain if you have a lot of icons or you simply dont feel like resizing them.

A suggestion to the solution would be adding a “ButtonSize” option on the FvwmButton. So you add your icon and if it has higher res than the ButtonSize value, it shrinks to that value. Simple to do, but not that simple to develop (or it would’ve been added already i presume 8) )

An Example:

DestroyModuleConfig DockBar: *
*DockBar: Colorset 1
*DockBar: geometry XxY+X+Y

*DockBar: (Icon term_256x256.png, ButtonSize 32x32, Action InvokeTerminal)

In this case the ‘term*.png’ file has a res higher than the specified on ButtonSize (32) so it would shrink from 256 to 32 pixels and fit nicely on the dockbar.[/code]

NOTE: i made this request topic because i didnt see any other like it on the section. Also from reading some posts by Thomas i see that it is not implemented. However, i dont know if it can be worked around (havent tested any workarounds).

I’m not entirely sure if this is what you mean, but I take it you’ve used something like *FvwmButton: (Icon 32x32.xpm)
So, you have also the option of doing Colorset 10 Pixmap 32x32.xpm *FvwmButton: (Colorset 10)
Check man FvwmTheme for more, since there is also options such as AdjustedPixmap, TiledPixmap etc.

Try this:

Colorset 20 fg #000000, bg #6d96bb, AspectPixmap devil.png

DestroyModuleConfig TaskBar: *
*TaskBar: Geometry 64x64
*TaskBar: Rows 1
*Taskbar: Columns 1
*TaskBar: (1x1, Frame 0, Colorset 20, Title "", Action(Mouse 1) "Popup RootMenu")

devil.png is 128x128. When the button starts it is resized to 64x64 to fit the button geometry. It works for the most part, but if you drag a window over it, the part of the image under the window will refresh and not be centered. When you move the window off of the button you will have an ugly layered image. It could be something I’ve done that causes this though.

On a semi-offtopic note, I would like this feature to be more generic. E.g. automatic resize of icons (if desired icon size is specified in some generic way) everywhere, not just in FvwmButtons.

Menu looks kinda stupid with all the icons in different sizes, for example.