Re: fvwm-menu-directory patch
lol, dang.. As it turns out I'm running 2.5.10 :P oh well. Thanks for the update! -- Matt. > On 18 Dec 2004 18:29:13 -0500, Matt DeLuco wrote: >> >> I use fvwm-menu-directory for a couple different directories (one for playing music, the other for setting backgrounds.) Recently I organized my backgrounds in to alphabetical subdirectories which is when I began to have problems. >> >> I have two functions that use fvwm-menu-directory, as follows: >> > [...] >> >> It took me a while to figure out that fvwm-menu-directory only uses "FuncFvwmMenuDirectory" as the fvwm function for all generated >> submenus. I had a look at the command's output in the shell then dug through the perl script to figure this out. >> >> So what I did was add another command line option to >> fvwm-menu-directory. You can actually see it in the above functions "--fvwm-function". It defaults to FuncFvwmMenuDirectory unless $reuse is set. > > Accourding to NEWS file, fvwm-menu-directory --func-name option > was added in 2.5.11. I may backport it to 2.4.x if you want. > > Regards, > Mikhael. > -- Visit the official FVWM web page at http://www.fvwm.org/>. To unsubscribe from the list, send "unsubscribe fvwm-workers" in the body of a message to [EMAIL PROTECTED] To report problems, send mail to [EMAIL PROTECTED]
Re: fvwm-menu-directory patch
On 18 Dec 2004 18:29:13 -0500, Matt DeLuco wrote: > > I use fvwm-menu-directory for a couple different directories (one for > playing music, the other for setting backgrounds.) Recently I organized > my backgrounds in to alphabetical subdirectories which is when I began > to have problems. > > I have two functions that use fvwm-menu-directory, as follows: > [...] > > It took me a while to figure out that fvwm-menu-directory only uses > "FuncFvwmMenuDirectory" as the fvwm function for all generated > submenus. I had a look at the command's output in the shell then dug > through the perl script to figure this out. > > So what I did was add another command line option to > fvwm-menu-directory. You can actually see it in the above functions > "--fvwm-function". It defaults to FuncFvwmMenuDirectory unless $reuse > is set. Accourding to NEWS file, fvwm-menu-directory --func-name option was added in 2.5.11. I may backport it to 2.4.x if you want. Regards, Mikhael. -- Visit the official FVWM web page at http://www.fvwm.org/>. To unsubscribe from the list, send "unsubscribe fvwm-workers" in the body of a message to [EMAIL PROTECTED] To report problems, send mail to [EMAIL PROTECTED]
Re: fvwm-menu-directory patch
Mikhael Goikhman <[EMAIL PROTECTED]> writes: > > I didn't check the patch yet, but I probably prefer this syntax: > > --exec-mime="xv -nolimits; jpg|jpeg, mplayer -fs %n; mov|mpg|mpeg" > > Or better yet instead of your option, add this one: > > --use-mailcap > > that just parses and uses existing ~/.mailcap and ~/.mime.types. Sorry, I didn't see your post. Anyway I'm glad you have some good ideas how to make this command-line option. Because I didn't like it myself. Then I will try to make this then > > P.S. I would like you to keep the strict indentation (one TAB only, never > spaces) in the code, otherwise I will need to change it manually. > I will try to set this up too. Greetings marco -- calmar (o_ GNU/Linux is GREAT //\ V_/_http://www.calmar.ws -- Visit the official FVWM web page at http://www.fvwm.org/>. To unsubscribe from the list, send "unsubscribe fvwm-workers" in the body of a message to [EMAIL PROTECTED] To report problems, send mail to [EMAIL PROTECTED]
Re: fvwm-menu-directory patch
calmar <[EMAIL PROTECTED]> writes: > Hi, > I'm wondering if there is any interest in a little patch at the > fvwm-menu-directory. > So I added `icon support'. those new options would be , | --exec-gen=program1:ext1/ext2/ext3+program2:ext1:ext2 ... ` then to those programs it's possible to assign a icon , | --icon-gen=program1:icon.xpm+program2:icon2.xmp ` so here's the new patch (the hold had anyway a fault, because I forgot to comment out a debug print .. line. Even so it worked anyway. Anyway, Best Greetings marco candrian --- /usr/local/bin/fvwm-menu-directory2 2004-02-15 19:45:48.0 +0100 +++ fvwm-menu-directory 2004-02-27 17:38:32.0 +0100 @@ -20,12 +20,18 @@ my $iconD = ""; my $iconF = ""; my $iconA = ""; +### calmar hacked here ### +my $iconGen = "xv:mini.xv.xpm+mplayer:mini.tetris.xpm"; # prog1:pixmap+prog2:pixmap2 +### my $home = $ENV{'HOME'} || '/tmp'; my $dir = $home; my $xterm = "xterm -e"; # the X terminal program to invoke my $execT = $ENV{'SHELL'} || '/bin/sh'; my $execF = $ENV{'EDITOR'} || "vi"; # the command to execute on plain files my $execA = undef; +### calmar hacked here ### +my $extGen = "xv:jpg/jpeg+mplayer:mov/mpg/mpeg+xmms:mp3/wav"; # prog1:ext1/ext2/ext3+prog2:ext1/... +### my $commT = undef; my $commF = undef; my $commA = undef; @@ -53,6 +59,9 @@ "icon-dir=s" => \$iconD, "icon-file=s" => \$iconF, "icon-app=s" => \$iconA, +### calmar hacked here ### +"icon-gen=s" => \$iconGen, +### "dir=s"=> \$dir, "order=i" => \$order, "all!" => \$all, @@ -61,6 +70,9 @@ "exec-title=s" => \$execT, "exec-file=s" => \$execF, "exec-app:s" => \$execA, +### calmar hacked here ### +"exec-gen=s" => \$extGen, +### "command-title=s" => \$commT, "command-file=s" => \$commF, "command-app=s" => \$commA, @@ -140,7 +152,6 @@ $commT = defined $execT? qq(Exec cd "%d"; $execT): "Nop" if !defined $commT; $commF = defined $execF? qq(Exec $execF "%f"): "Nop" if !defined $commF; $commA = defined $execA? qq(Exec $execA "%f"):$commF if !defined $commA; - # manage special directories if needed my ($specialDirLines, $specialDirPos, @specialDirs) = (""); $specialDirVal = "1,2" if defined $specialDirVal && $specialDirVal eq ""; @@ -195,6 +206,7 @@ print qq(+ MissingSubmenuFunction FuncFvwmMenuDirectory\n) unless $reuse; # add a new title (item and separator, or real Title if no action) + my $titleAct = $commT; $titleAct =~ s/%d/$dir/g; if ($title ne "") { if ($titleAct eq "") { @@ -207,6 +219,39 @@ # add special dirs at the top if needed print qq($specialDirLines+ "" Nop\n) if $specialDirPos > 0; +### calmar hacked here ### +# puts strings like this: xv:jpg/jpeg+mplayer:mov/mpg/mpeg+xmms:mp3 +# into an hash: --> may uncomment foreach loops below to see output + + my %extHash; + my $prog; + my $ext; + my $rest; + + foreach (split (/\+/,$extGen)) { + ($prog, $rest) = split ( /:/, $_ , 2); + foreach $ext ( split (m|\/|, $rest)) { + $extHash{$ext} = $prog ; + } + } + +# do about the same with the $iconGen string variable. + + my %iconHash; + foreach (split (/\+/,$iconGen)) { + ($prog, $rest) = split ( /:/, $_ , 2); + $iconHash{$prog} = $rest ; + } + + +# foreach $ext ( keys %extHash ) { +# print "ext $ext: $extHash{$ext}\n"; +# } +# foreach $ext ( keys %iconHash ) { +# print "prog $ext: $iconHash{$ext}\n"; +# } +## + # add directory contents foreach (@files) { next if $_ eq '.' or $_ eq '..'; @@ -222,6 +267,18 @@ my $isApp = -x && -f; my $iconStr = $isApp && $iconAStr? $iconAStr: $iconFStr; my $fileAct = $isApp? $commA: $commF; +### calmar hacked here ### +# overwrite $fileAct when the file ending and the program are in @extHash + my $fileEnd = lc(); #lowercase $_ +$fileEnd =~ s|.*\.||; # get ending + if ($extHash{$fileEnd}) { + $fileAct = qq(Exec $extHash{$fileEnd} "%f"); + } +# when there is a file ending assigned to a program, check for icon for program + if ($iconHash{$extHash{$fileEnd}}) { + $iconStr = qq(%$iconHash{$extHash{$fileEnd}}%); + } +### $fileAct =~ s/%f/&escapeFileName($filePath)/ge; print qq(+ "$iconStr$itemStr" $fileAct\n); } -- calmar (o_ GNU/Linux is GREAT //\ V_/_http://www.calmar.ws
Re: fvwm-menu-directory patch
On 27 Feb 2004 11:33:18 +0100, calmar wrote: > > I'm wondering if there is any interest in a little patch at the > fvwm-menu-directory. > > An additional command line what should define with what kind of a > program files with specific endings should get opened. > > the additional command line option would look like this: > > exec-gen="xv=jpg|jpeg,mplayer=mov|mpg|mpeg,xmms=mp3" > > that would mean, xv should open all endings: jpg, jpeg, > mplayer should open endings: mov, mpg, mpeg and > xmms should be used to open mp3 files. > > for personal use this would be already enough for me actually, > but when this would be interesting to enhance ( icons ), i could > do it as well. > > Actually a quick hack with special markings to see where i hacked > around. I'm not really a perl programmer, but I hope it's all ok anyway. I didn't check the patch yet, but I probably prefer this syntax: --exec-mime="xv -nolimits; jpg|jpeg, mplayer -fs %n; mov|mpg|mpeg" Or better yet instead of your option, add this one: --use-mailcap that just parses and uses existing ~/.mailcap and ~/.mime.types. P.S. I would like you to keep the strict indentation (one TAB only, never spaces) in the code, otherwise I will need to change it manually. Regards, Mikhael. -- Visit the official FVWM web page at http://www.fvwm.org/>. To unsubscribe from the list, send "unsubscribe fvwm-workers" in the body of a message to [EMAIL PROTECTED] To report problems, send mail to [EMAIL PROTECTED]