Subject: FVWM: Gnome icons in root menu.

From: Atul Awasthi <[email-masked]>
Date: Wed, 4 Aug 2004 12:54:52 +0530

I can succesfully use gnome icons with semi-auto updates on root menu.
Here is how it works.

###################################################################
SetEnv fvwm_icons $[HOME]/.icons/Marcintesh_OS-W/
#
#
#
+   "System"%$[fvwm_icons]192x192/apps/gnome-system.png%           
Popup MenuSystem
+   "Office"%$[fvwm_icons]192x192/apps/gnome-applications.png%        
     Popup MenuOffice
###################################################################

And so on... Now next time when I need to change the icons. I just
need to change the fvwm_icons path. But as you might have guessed,
there is one big problem with it. The icons are too huge.. Is there a
way to resize them before using? I know there is since there is a
wallpaper browser that does the same thing for every PNGs in a
wallpaper directory.
Here is the code for that..

###################################################################
#### Browse Wallpapers Directory
DestroyFunc WallpaperBrowser
AddToFunc WallpaperBrowser
+ I PipeRead 'test ! -d "$0/.thumbs" && mkdir "$0/.thumbs"; \
    for i in "$0/"*; do \
        test -f "$0/.thumbs/${i##*/}" \
            -a "${i}" -ot "$0/.thumbs/${i##*/}" || { \
                convert -quality 0 -scale 24 "${i}"
"png:$0/.thumbs/${i##*/}" 2>/dev/null \
                    || continue; \
            }; \
    done; \
    fvwm-menu-directory --icon-title icons/blue/browse.png --icon-file
__PIXMAP__ \
    --icon-dir icons/blue/browse.png --dir $0 --exec-file "^Esetroot -s" \
    --exec-t="^eog *" | sed -e "s#FuncFvwmMenuDirectory#WallpaperBrowser#g" \
    -e "s#__PIXMAP__\\(.*\\)\\"\\(.*/\\)\\(.*\\)\\"#\\2.thumbs/\\3\\1\\2\\3#g"'
###################################################################

There is one more thing that needs to be taken care of.. Setting a
fallback icons that can be used when the icons doesnt exist in
fvwm_icons. Complete icon set is pretty rare in gnome stock icons, so
the menu should be able to use pre specified icons when the default
ones (fvwm_icons) are missing.

As you can guess, I am trying to get a semi-automated icon updates for
menu, but since I have no skills in bash scripting, I will be forever
thankful to you while updating the icons, If someone can be kind
enough to do the hard job :)

Thanks.
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 4 Aug 2004 08:15:42 +0000

On 04 Aug 2004 12:54:52 +0530, Atul Awasthi wrote:
> [code that resizes icons using convert]

Currently there is no way to cause fvwm to resize icons in the menu
automatically. You may resize them on the fly like you suggest, but I
can't recommend this. It would be very slow to resize dozens of icons.

Instead, I may suggest a solution that wm-icons project uses. Prepare all
your complete icon sets before you use them (find appropriate large icons
and resize them using convert). Then your config may look like:

  ImagePath $[HOME]/.fvwm/gnome-icons:+

  +   "System%menu/gnome-system.png%"  Popup MenuSystem
  +   "Office%menu/gnome-applications.png%"  Popup MenuOffice

And you have these subdirectories in ~/.fvwm/gnome-icons/ dir:

  22x22-Marcintesh_OS-W/  with gnome-system.png resized to 22x22
  22x22-Windertosh_OS-M/  with gnome-system.png resized to 22x22

  menu - a symbolic link to the actual icon set, 22x22-Marcintesh_OS-W

To chenge an icon set, just replace the 'menu' symbolic link (ln -sfn)
and reread the menu definition (or do Restart).

> fallback icons that can be used when the icons doesnt exist

You may make your icon sets complete by taking icons from another
incomplete icon sets in GNOME. Or you may create one complete
~/.fvwm/gnome-icons/default set and have all missing icons like
~/.fvwm/gnome-icons/Golden/gnome-game.png to be symlinks to
../default/gnome-game.png.

As you see, my suggestion is not fully automatical and requires some
manual work of preparing icons sets, but it produces the best results
once done. Maybe someone who uses GNOME may suggest the actual code to
automate the creation of such complete resized icon sets.

Regards,
Mikhael.

---

From: Ahmed Abdalla <[email-masked]>
Date: Wed, 04 Aug 2004 04:20:46 +0000

Hello Atul:
> I can succesfully use gnome icons with semi-auto updates on root menu.
Interesting way of integrating fvwm with gnome.
> ...
Here is the bash script I wrote to convert icons for my menus:
#menuconvert.sh
#----Menu converting script:
#by: Ahmed Abdalla
#!/bin/bash
#
#This changes the current directory to the fonts directory.
cd /mnt/space/images/icons  ###You will need to change this to 
# your icon folder
#These two lines remove old versions of the icons in case
# there have been changes.
rm -f menu.*
rm -f sidemenu.*
#Sets the variable flist to the list of files in the icon folder
flist="*"
#Starts a loop for all files in the directory.
for file in $flist
do
#These two lines create two sets of icons, one set (20x20)
# for the root menu, and the other set for my side menus (40x40)
convert -scale 20x20 ${file} menu.${file}
convert -scale 40x40 ${file} sidemenu.${file}
#Closes the for loop
done
#Lists all the files in the icon folders
ls /mnt/space/images/icons/
#Prints out 
echo done
# Prints "done" to stdout.
###  EOF

As you can see, it is pretty simple.  The ls and echo commands aren't
needed, as you probably will want this script to be automated as well,
to reflect any changes in the icon directory, every five minutes, for
example.  Just copy this to a file and give it a+rx permissions and you
should be able to execute it ./menuconvert.sh (or whatever you choose to
call it), or you can write in into an fvwm function as needed.

> ...

I hope that helps, at least with converting icons,

Ahmed Abdalla

---

From: Atul Awasthi <[email-masked]>
Date: Wed, 4 Aug 2004 14:44:54 +0530

Hey Ahmed,
Thanks a lot for that script. That would work wonderfully!
I can do this.. 

###################################################################
SetEnv fvwm_icons $[HOME]/.fvwm/images/icons/current/
#
#
#
+   "System"%$[fvwm_icons]menu.gnome-system.png%      Popup MenuSystem
+   "Office"%$[fvwm_icons]menu.gnome-applications.png%      Popup MenuOffice
###################################################################

And just overwrite with new icons in directory
~/.fvwm/images/icons/current/ and run that script again.
Thanks man.. Its a sure way to get all the sweet gnome icons with
virtually no work at all!

Just one more small thing? Can that script convert icons in recursive
manner?! Yeah, I am THAT lazy :P

---

From: Ahmed Abdalla <[email-masked]>
Date: Wed, 04 Aug 2004 11:48:13 +0000

I've attached a new version of the script.  It reports an error:
/bin/recursivemenuconvert.sh: line 20: [: too many arguments, but this
doesn't effect function, and, quite honestly, I couldn't find where the
error, if any, was.  If you want to debug it, feel free (I would like to
know my mistake).

Ahmed Abdalla

ps.  If the file attachment gets stripped by a mail client or service, I
can email it to you inline.

---

From: Ahmed Abdalla <[email-masked]>
Date: Fri, 06 Aug 2004 03:24:08 +0000

I just tried to set up a second root menu by splitting my current root
menu (MenuFvwmRoot) into two separate menus (MenuFvwmLeftRoot,
MenuFvwmRightRoot).  However, when I bind these two menus to mouse 1 and
mouse 3, they cause fvwm to take forever to start or restart.  This does
not occur when I change the bindings back to mouse 1 by itself. 
Previously, mouse 3 was bound to open MenuFvwmRoot as well, with no
problems.  The delays are reproducible every time I change the mouse 3
bindings.  There is no output from /var/log/messages or .xsession-errors
that seem to be spawned by fvwm and related to the mouse.  I have tried
the bindings with IgnoreModifiers L25 set and commented out, and the
delays are still present, either way.  I have read through the man page
and have not found anything that would cause this.

Many thanks,
Ahmed

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 6 Aug 2004 10:01:01 +0200

> and have not found anything that would cause this.

Please strip down your config as much as possible so that the
problem is still present and post it to the mailing list.

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]

---

From: Ahmed Abdalla <[email-masked]>
Date: Fri, 06 Aug 2004 05:21:47 +0000

The stripped config is attached.  I left just enough in it so that it
will boot and you can maybe see where the problem is.  I reinstalled
fvwm, and the problem has continued.

Many thanks,
Ahmed

---

From: Ahmed Abdalla <[email-masked]>
Date: Fri, 06 Aug 2004 14:08:01 +0000

I have tried other people's configs and restarting takes no time at
all.  I am assuming the issue is in my config, but I have yet to find
what it is.

Thanks,
Ahmed

---

From: Dominik Vogt <[email-masked]>
Date: Sat, 7 Aug 2004 00:43:46 +0200

> fvwm, and the problem has continued.

(Please write replies below the quoted text on this mailing list,
not above it).

[snip snip snip]

> Destroy MenuFvwmRightRoot
  ^^^^^^^

This command looks for a window to destroy and waits for a button
press.  You have to use DestroyMenu here too.

Ciao

Dominik ^_^  ^_^