FVWM: Is it possible to resize automatically icons in AddToMenu?

2015-12-11 Thread Oleksandr Gavenko
Look to syntax %...%  in:

  DestroyMenu MenuMyDev
  AddToMenu   MenuMyDev "My Dev Menu" Title
  + %iceweasel.png% Exec exec firefox -no-remote -P devel

ImagePath control colon search path for icons and I have broad definition to
gather different sources (as many as possible):

  m4_define(`m4_IMGPATH', `$[FVWM_USERDIR]/images')m4_dnl
  m4_define(`m4_ICONPATH', `$[FVWM_USERDIR]/icons')m4_dnl

  ImagePath m4_ICONPATH:m4_IMGPATH:+

  ImagePath +:/usr/share/icons/gnome/16x16/places
  ImagePath +:/usr/share/icons/gnome/32x32/apps
  ImagePath +:/usr/share/icons/gnome-colors-common/32x32/apps
  ImagePath +:/usr/share/icons/locolor/32x32/apps
  # ImagePath +:/usr/share/icons/hicolor/16x16/apps
  ImagePath +:/usr/share/icons/hicolor/22x22/apps
  ImagePath +:/usr/share/icons/hicolor/24x24/apps
  ImagePath +:/usr/share/icons/hicolor/32x32/apps
  ImagePath +:/usr/share/icons/hicolor/48x48/apps
  # ImagePath +:/usr/share/icons/hicolor/64x64/apps
  # This paths contain large icons for some apps, they make menus look ugly...
  # ImagePath +:/usr/share/app-install/icons/
  # ImagePath +:/usr/share/pixmaps

Some paths commented because they provide too big images. Fvwm uses exact
size of image when it displays icon. Some of them occupy half of screen!

Are there any syntax:

 (1) to set maximum allowed icon size for displaying (and ignore large image)?
 (2) to specify how resize image (scale down any that bigger then ...)?

I can't control which icon is supplied by package in Debian repository. That
is true for:

  /usr/share/app-install/icons/
  /usr/share/pixmaps/

Most package doesn't respect /usr/share/icons/hicolor/24x24/apps like
directories and place icons in above paths.

Auto-generated /etc/X11/fvwm/menudefs.hook uses full path to icon so I can't
select desired size by ImagePath.

Some 3rd-party packages I install in /opt hierarchy and usually they also have
single BIG icon.

I like to see (2) option e.g. something like:

  + %iceweasel.png%32% Exec exec firefox -no-remote -P devel

but (1) option also take a lot of images from /usr/share/pixmaps like
directories.

Another option is to preprocess /etc/X11/fvwm/menudefs.hook and place resized
images into predefined path.

Or carefully craft processing of /etc/xdg/menus/*.menu. I use xdg.Menu and
xdg.DesktopEntry Python classes to build menus myself.

If Fvwm hold menu images into memory (without loading on demand) - present of
(2) option looks natural for me.

-- 
Best regards!




Re: FVWM: Is it possible to resize automatically icons in AddToMenu?

2015-12-11 Thread Dan Espen
Oleksandr Gavenko  writes:

> Look to syntax %...%  in:
>
>   DestroyMenu MenuMyDev
>   AddToMenu   MenuMyDev "My Dev Menu" Title
>   + %iceweasel.png% Exec exec firefox -no-remote -P devel
>
> ImagePath control colon search path for icons and I have broad definition to
> gather different sources (as many as possible):
>
>   m4_define(`m4_IMGPATH', `$[FVWM_USERDIR]/images')m4_dnl
>   m4_define(`m4_ICONPATH', `$[FVWM_USERDIR]/icons')m4_dnl
>
>   ImagePath m4_ICONPATH:m4_IMGPATH:+
>
>   ImagePath +:/usr/share/icons/gnome/16x16/places
>   ImagePath +:/usr/share/icons/gnome/32x32/apps
>   ImagePath +:/usr/share/icons/gnome-colors-common/32x32/apps
>   ImagePath +:/usr/share/icons/locolor/32x32/apps
>   # ImagePath +:/usr/share/icons/hicolor/16x16/apps
>   ImagePath +:/usr/share/icons/hicolor/22x22/apps
>   ImagePath +:/usr/share/icons/hicolor/24x24/apps
>   ImagePath +:/usr/share/icons/hicolor/32x32/apps
>   ImagePath +:/usr/share/icons/hicolor/48x48/apps
>   # ImagePath +:/usr/share/icons/hicolor/64x64/apps
>   # This paths contain large icons for some apps, they make menus look ugly...
>   # ImagePath +:/usr/share/app-install/icons/
>   # ImagePath +:/usr/share/pixmaps

I don't see the logic of adding all the different icon sizes to your
image path.  They all have the same names, so only the first size you
mention is going to be found.

> Some paths commented because they provide too big images. Fvwm uses exact
> size of image when it displays icon. Some of them occupy half of screen!
>
> Are there any syntax:
>
>  (1) to set maximum allowed icon size for displaying (and ignore large image)?
>  (2) to specify how resize image (scale down any that bigger then ...)?

No.  You wouldn't want your icon resized each time it's displayed.
Better to pick the size you want at startup time like
fvwm-menu-desktop does.

> I can't control which icon is supplied by package in Debian repository. That
> is true for:
>
>   /usr/share/app-install/icons/
>   /usr/share/pixmaps/
>
> Most package doesn't respect /usr/share/icons/hicolor/24x24/apps like
> directories and place icons in above paths.
>
> Auto-generated /etc/X11/fvwm/menudefs.hook uses full path to icon so I can't
> select desired size by ImagePath.
>
> Some 3rd-party packages I install in /opt hierarchy and usually they also have
> single BIG icon.
>
> I like to see (2) option e.g. something like:
>
>   + %iceweasel.png%32% Exec exec firefox -no-remote -P devel
>
> but (1) option also take a lot of images from /usr/share/pixmaps like
> directories.
>
> Another option is to preprocess /etc/X11/fvwm/menudefs.hook and place resized
> images into predefined path.
>
> Or carefully craft processing of /etc/xdg/menus/*.menu. I use xdg.Menu and
> xdg.DesktopEntry Python classes to build menus myself.
>
> If Fvwm hold menu images into memory (without loading on demand) - present of
> (2) option looks natural for me.

You've lost me.
menudefs.hook looks to me like some kind of menu generator.
You should try fvwm-menu-desktop if you haven't done so already.
Use the size= parameter to control the icon sizes.

-- 
Dan Espen