vfmg (DEVEL): vfmg - synced with HEAD

sparky sparky at pld-linux.org
Sun Oct 30 19:09:31 CET 2005


Author: sparky                       Date: Sun Oct 30 18:09:31 2005 GMT
Module: vfmg                          Tag: DEVEL
---- Log message:
- synced with HEAD

---- Files affected:
vfmg:
   vfmg (1.73.2.4 -> 1.73.2.5) 

---- Diffs:

================================================================
Index: vfmg/vfmg
diff -u vfmg/vfmg:1.73.2.4 vfmg/vfmg:1.73.2.5
--- vfmg/vfmg:1.73.2.4	Sat Sep 18 14:48:51 2004
+++ vfmg/vfmg	Sun Oct 30 19:09:25 2005
@@ -41,7 +41,7 @@
 	);
 
 if($o_help) {
-	print "Usage:	$0 [options] {aewm, afterstep, blackbox, enlightenment, fbpanel, fluxbox, fvwm2, icewm, openbox, olvwm, qvwm, wmaker, wmaker-old, xfce4, xpde}
+	print "Usage:	$0 [options] {aewm, afterstep, blackbox, enlightenment, fbpanel, fluxbox, fvwm, fvwm2, icewm, metisse, openbox, olvwm, qvwm, wmaker, wmaker-old, xfce4, xpde}
 	-h, --help	- print this help
 	-t, --tags	- echo omitted tags to stderr
 	-e, --end	- echo omitted XDG file ending to stderr
@@ -60,11 +60,13 @@
 	exit;
 }
 
-die "Missing argument {aewm, afterstep, blackbox, enlightenment, fbpanel, fluxbox, fvwm2, icewm, openbox, olvwm, qvwm, wmaker, wmaker-old, xfce4, xpde}\n"
+die "Missing argument {aewm, afterstep, blackbox, enlightenment, fbpanel, fluxbox, fvwm, fvwm2, icewm, metisse, openbox, olvwm, qvwm, wmaker, wmaker-old, xfce4, xpde}\n"
 	unless exists $ARGV[0];
 $o_output=$ARGV[0];
 die "Unrecognized argument: $o_output\n"
-	unless $o_output=~/^(aewm|afterstep|blackbox|enlightenment|fbpanel|fluxbox|fvwm2|icewm|openbox|olvwm|qvwm|wmaker|wmaker-old|xfce4|xpde)$/;
+	unless $o_output=~/^(aewm|afterstep|blackbox|enlightenment|fbpanel|fluxbox|fvwm|fvwm2|icewm|metisse|openbox|olvwm|qvwm|wmaker|wmaker-old|xfce4|xpde)$/;
+
+$o_full=1 if $o_icons and $o_output=~/^(enlightenment|metisse)$/;
 
 my @xdg_data_dirs = grep -d,
   ( exists $ENV{'XDG_DATA_HOME'}
@@ -282,6 +284,7 @@
 my $tag;
 my $name;
 my $dir;
+my $icon_dir;
 my @directory;	# $directory[level]=[name,icon]
 my $include;
 my $tmpapps;
@@ -509,6 +512,8 @@
 				my $exists=0;
 				foreach my $dir(@icondirs) {
 					if(-f "$dir$icon") {
+					} elsif(-f "$dir$icon.svg") {
+						$icon.=".svg";
 					} elsif(-f "$dir$icon.xpm") {
 						$icon.=".xpm";
 					} elsif(-f "$dir$icon.png") {
@@ -622,6 +627,25 @@
 	}
 }
 
+my $DoConvert = `which convert`;
+sub scale_icon {
+	my $icon_in = $_[0];
+
+	return $icon_in unless $DoConvert;
+
+	my $icon_out = $icon_in;
+	my $icon_ext = $_[1];
+	my $convert_options = $_[2];
+
+	$icon_out =~ s/^.*\///;
+	$icon_out =~ s/\..*$//;
+	$icon_out = "$icon_dir/$icon_out.$icon_ext";
+	if( ! -f "$icon_out") {
+		system("convert $convert_options $icon_in $icon_out");
+	}
+	return $icon_out;
+}
+
 $level="";
 sub icewm {
 	my $no=$_[0];
@@ -732,6 +756,7 @@
 sub afterstep {
 	my $no=$_[0];
 	my $dir=$_[1];
+	print "dir=".$dir;
 	foreach my $entry(keys %{$menu[$no]}) {
 		$name=$entry;
 		if($menu[$no]{$entry}[0]<0) {
@@ -753,6 +778,41 @@
 	}
 }
 
+sub fvwm {
+	my $no=$_[0];
+	my $file=$_[1];
+	$file=~s|^\.||;
+	my $basename=$_[2];
+	foreach my $entry(keys %{$menu[$no]}) {
+		if($menu[$no]{$entry}[0]>=0) {
+			$name=substr($entry,1);
+			$name=~s|/||g;
+			my $menutitle=$name;
+			$name=~s/\s+/_/g;
+			fvwm($menu[$no]{$entry}[0],"$file.$name","$menutitle");
+		}
+	}
+	if (!$file) {
+		return;
+	}
+	print "Popup \"$file\"\n";
+	print "\tTitle \"$basename\"\n"; 
+	foreach my $entry(keys %{$menu[$no]}) {
+		if($menu[$no]{$entry}[0]<0) {
+			$name=$entry;
+			$name=~s/\"/\\\"/g;
+			print "\tExec \"$name\"\texec $menu[$no]{$entry}[2]\n";
+		} else { 
+			$name=substr($entry,1);
+			$name=~s|/||g;
+			my $menutitle=$name;
+			$name=~s/\s+/_/g;
+			print "\tPopup \"$menutitle\"\t$file.$name\n";
+		}
+	}
+	print "EndPopup\n\n";
+}
+
 sub fvwm2 {
 	my $no=$_[0];
 	my $file;
@@ -778,6 +838,46 @@
 	print "\n";
 }
 
+sub metisse {
+	my $no=$_[0];
+	my $file=$_[1];
+	$file=~s|^\.||;
+	my $basename=$_[2];
+	my $icon="";
+	foreach my $entry(keys %{$menu[$no]}) {
+		if($menu[$no]{$entry}[0]>=0) {
+			$name=substr($entry,1);
+			$name=~s|/||g;
+			my $menutitle=$name;
+			$name=~s/\s+/_/g;
+		      metisse($menu[$no]{$entry}[0],"$file.$name","$menutitle");
+		}
+	}
+	if (!$file) {
+		return;
+	}
+	print "DestroyMenu $file\n";
+	print "AddToMenu $file \"$basename\" Title\n";
+	foreach my $entry(sort keys %{$menu[$no]}) {
+		$icon=$menu[$no]{$entry}[1] if $o_icons;
+		$icon=scale_icon($icon,"png","-geometry 21x18") if $icon;
+		$icon="\%$icon\%" if $icon;
+		
+		if($menu[$no]{$entry}[0]<0) {
+			$name=$entry;
+			$name=~s/\"/\\\"/g;
+			print "+ \"$icon$name\"\tExec exec $menu[$no]{$entry}[2]\n";
+		} else {
+			$name=substr($entry,1);
+			$name=~s|/||g;
+			my $menutitle=$name;
+			$name=~s/\s+/_/g;
+			print "+ \"$icon$menutitle\"\tPopup\t$file.$name\n";
+		}
+	}
+	print "\n";
+}
+
 sub olvwm {
 	my $no=$_[0];
 	foreach my $entry(sort keys %{$menu[$no]}) {
@@ -844,16 +944,19 @@
 	open $F_OUT, ">> $dir/$_[1].menu" or warn "$dir/$_[1].menu: $!\n";
 	print $F_OUT "\"$_[2]\"\n";
 	foreach my $entry(sort keys %{$menu[$no]}) {
-		$name=$entry;
+		$name=encode($o_enc,$entry);
+		my $icon="";
+		$icon=$menu[$no]{$entry}[1] if $o_icons;
+		$icon=scale_icon($icon,"png","-geometry 18x18") if $icon;
 		if($menu[$no]{$entry}[0]<0) {
-			$name=~s/\"/\\\"/g;
-			print $F_OUT "\"$name\" \"$menu[$no]{$entry}[1]\" exec \"$menu[$no]{$entry}[2]\"\n";
+			$name=~s/\"/\'/g;
+			print $F_OUT "\"$name\" \"$icon\" exec \"$menu[$no]{$entry}[2]\"\n";
 		} else {
 			$name=substr($name,1);
 			$name=~s|/||g;
 			my $name2=$name;
-			$name2=~s/\"/\\\"/g;
-			print $F_OUT "\"$name2\" \"$menu[$no]{$entry}[1]\" menu \"$dir/$name2.menu\"\n";
+			$name2=~s/\"/\'/g;
+			print $F_OUT "\"$name2\" \"$icon\" menu \"$dir/$name2.menu\"\n";
 			enlightenment($menu[$no]{$entry}[0],"$name","$name");
 		}
 	}
@@ -927,10 +1030,15 @@
 	}
 }
 
-$o_enc="utf-8" if ($o_utf and not $o_enc);
+$o_enc||="utf-8" if $o_utf;
 #use open OUT => ':utf8';
-eval "use open OUT => ':locale'" unless $o_enc;
-binmode(STDOUT, ":encoding($o_enc)") if $o_enc;
+#eval "use open OUT => ':locale'" unless $o_enc;	# $o_enc always set
+unless ($o_enc) {
+	require I18N::Langinfo;
+	I18N::Langinfo->import(qw(langinfo CODESET));
+	$o_enc=langinfo(CODESET()) unless $o_enc;
+}
+binmode STDOUT, ":encoding($o_enc)";
 
 if($o_output eq "icewm") {
 	icewm($o_strip);
@@ -955,11 +1063,11 @@
 	exit;
 }
 if($o_output eq "xfce4") {
-	print "<xfdesktop-menu>
-	<title name=\"Desktop Menu\" visible=\"yes\"/>\n" unless $o_nomenu;
+	print "<xfdesktop-menu>\n";
+	print "<title name=\"Desktop Menu\" visible=\"yes\"/>\n" unless $o_nomenu;
 	$level.="	";
 	xfce4($o_strip);
-	print "</xfdesktop-menu>\n" unless $o_nomenu;
+	print "</xfdesktop-menu>\n";
 	exit;
 }
 if($o_output eq "afterstep") {
@@ -978,6 +1086,10 @@
 	afterstep($o_strip,$dir);
 	exit;
 }
+if($o_output eq "fvwm") {
+	fvwm($o_strip,"", "fvwm");
+	exit;
+}
 if($o_output eq "fluxbox") {	# This is the same as blackbox (I hope so)
 	print "[begin] (Fluxbox)\n" unless $o_nomenu;
 	blackbox($o_strip);
@@ -989,6 +1101,19 @@
 	fvwm2($o_strip);
 	exit;
 }
+
+if($o_output eq "metisse") {
+	$icon_dir="$ENV{'HOME'}/.fvwm-metisse/icons";
+	if(! -d "$icon_dir") {
+		if(-f "$icon_dir") {
+			rename("$icon_dir","$icon_dir.old");
+		}
+		mkpath("$icon_dir",0,0700);
+	}
+	metisse($o_strip,"", "metisse");
+	exit;
+}
+		
 if($o_output eq "olvwm") {
 	olvwm($o_strip);
 	exit;
@@ -1010,6 +1135,13 @@
 		rename("$dir","$dir.old");
 	}
 	mkpath("$dir",0,0700);	# or die
+	$icon_dir="$ENV{'HOME'}/.enlightenment/icons";
+	if(! -d "$icon_dir") {
+		if(-f "$icon_dir") {
+			rename("$icon_dir","$icon_dir.old");
+		}
+		mkpath("$icon_dir",0,0700);
+	}
 	enlightenment($o_strip,"index","Enlightenment");
 	exit;
 }
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/vfmg/vfmg?r1=1.73.2.4&r2=1.73.2.5&f=u




More information about the pld-cvs-commit mailing list