Subject: FVWM: Broken Dynamic Menus

From: Scott Rubin <[email-masked]>
Date: Tue, 18 Jan 2005 23:24:58 -0500

Ok, so I have some dynamic menus (FuncFvwmMenuDirectory) I use for browsing 
certain directories on my drive. Mostly my documents, movies and music 
directories. They worked and still partially do. Recently I modified my menus a 
bit and now my dynamic menus only allow me to browse 2 directories deep. It 
simply wont do anything if I try to browse deeper than that. My fvwm 
configuration is available for your viewing pleasure at 
http://apreche.net/~apreche/fvwm2rc

Thanks,

Scott Rubin
--
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: Andrew Dolgov <[email-masked]>
Date: Wed, 19 Jan 2005 11:28:36 +0300

Oh, I have another question regarding dynamic menus bug. By the way,
thanks to everybody for suggestions on FvwmButtons :-)

I have a big partially-dynamic menu, a-la fvwm-themes where you can
customize colorsets, iconsets et cetera completely on the fly. The
problem is, generated menus are sometimes attached to the wrong
points, e.g. themes menu is attached to colorsets title in the parent
menu.

If I reopen the menu it shows fine sometimes, sometimes not, which is
somewhat annoying. his seems to appear more if the menu structure is
more complex.

Maybe there is something wrong with my scripts which generate menus, I
don't know. Maybe it is a FVWM bug.

My scripts/configs are here: http://bah.spb.su/~fox/fvwm/

-- 
Andrew.

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 19 Jan 2005 15:06:58 +0000

On 18 Jan 2005 23:24:58 -0500, Scott Rubin wrote:
> directories. They worked and still partially do. Recently I modified my 
> menus a bit

Do you remember what did you modify exactly?

> and now my dynamic menus only allow me to browse 2 directories 
> deep. It simply wont do anything if I try to browse deeper than that. My 
> fvwm configuration is available for your viewing pleasure at 

Can you please strip the config to several lines that show your problem
and post these lines here. Also you should attach (url) some example
directory layout that does not work as expected for you.

Without this, it is impossible to say anothing concrete. I just copied
your FuncFvwmMenuDirectory function definition plus the menus containing
"MissingSubmenuFunction FuncFvwmMenuDirectory" and everything works for
any subdirectory depth. (I changed paths a bit.)

Similarly, it is hard to answer anything concrete to Andrew Dolgov, since
he didn't strip his config to several lines that could be pasted to
FvwmConsole.

Personally, I don't think there are problems with dynamical menus in fvwm
similar to the ones described in this thread. Dynamical menus worked for
me without problem for years.

Debugging of dynamical configuration is not easy indeed. I may suggest to
create shell scripts and test them from the command line, and call these
scripts in fvwm configuration, instead of coding unix commands directly.

Regards,
Mikhael.

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 19 Jan 2005 15:39:02 +0000

On 18 Jan 2005 23:24:58 -0500, Scott Rubin wrote:
> menus a bit and now my dynamic menus only allow me to browse 2 directories 

On the second try, I can reproduce your problem. Your large "sed" line
seems buggy, if you remove the pipe to sed, it will work well.

Like I suggested in the previous message, don't code unix commands in
fvwm config directly (unless you are good in debugging of such things).
Instead, create a shell script my-fvwm-menu that gets one parameter
(dir name) and does all the work, like setting icons/titles and calling
fvwm-menu-directory with correct parameters, and filtering using sed,
if needed.

Then test this my-fvwm-menu script from the command line, and after you
verified it works for all your directories, use it like this:

  DestroyFunc FuncFvwmMenuDirectory
  AddToFunc   FuncFvwmMenuDirectory
  + I PipeRead `my-fvwm-menu '$0'`

The DestroyFunc line is very important when you debug your config, it
ensures you always replace the function (or menu) definition and not
unintentionally add to the previous definition.

Regards,
Mikhael.

---

From: Scott Rubin <[email-masked]>
Date: Wed, 19 Jan 2005 10:54:19 -0500

Thanks! I thought it was something to do with the sed line. I'm not the best
with regular expressions. Also, thanks for the tip on putting that stuff into
another file as a script. I'll do that right away. Now, does anyone see what's
wrong with the sed script?  Is there a better way than that to set different
icons on different files? Using sed feels really hacky.

-Scott

---

From: Chris Debenham <[email-masked]>
Date: Thu, 20 Jan 2005 09:18:56 +1100

The problem isn't nessecarily with the sed line itself its actually that the line length gets too long. Try shortening it like:
AddToFunc FuncFvwmMenuDirectory
+ I PipeRead 'test -f "$0"/.icontitle.png && mytitle="$0"/.icontitle.png;\
    fvwm-menu-directory -d "$0" --exec-title "^rox" --exec-file "^rox"\
    --icon-dir "folder_blue.png" --icon-title "folder_green.png"\
    --icon-file=__PIXMAP__ | sed\
    -e "s/__PIXMAP__\\(%.*.[mp3|MPG|ogg]\\)/sound.png\\1/g"\
    -e "s/__PIXMAP__\\(%.*.[png|jpg|JPG|jpeg|gif|GIF|bmp]\\)/image.png\\1/g"\
    -e "s/__PIXMAP__\\(%.*.[avi|mpg|AVI|MPG|mpeg|MOV|mov]\\)/video.png\\1/g"'

This worked for me (browsed 8 levels deep)

Chris

On Wed, Jan 19, 2005 at 10:54:19AM -0500, Scott Rubin wrote in a legally binding way:
> Date: Wed, 19 Jan 2005 10:54:19 -0500
> From: Scott Rubin <[email-masked]>
> Organization: RIT
> To: [email-masked]
> Subject: Re: FVWM: Broken Dynamic Menus
> 
> >>Ok, so I have some dynamic menus (FuncFvwmMenuDirectory) I use for 
> >>browsing certain directories on my drive. Mostly my documents, movies and 
> >>music directories. They worked and still partially do. Recently I 
> >>modified my menus a bit and now my dynamic menus only allow me to browse 
> >>2 directories deep. It simply wont do anything if I try to browse deeper 
> >>than that. My fvwm configuration is available for your viewing pleasure 
> >>at http://apreche.net/~apreche/fvwm2rc
> >
> >

-- 
Santa's Elves Are Just A Bunch Of Subordinate Clauses.