vfmg (DEVEL): vfmg - basic enlightenment DR17 support - case insen...
sparky
sparky at pld-linux.org
Tue Nov 1 15:49:51 CET 2005
Author: sparky Date: Tue Nov 1 14:49:50 2005 GMT
Module: vfmg Tag: DEVEL
---- Log message:
- basic enlightenment DR17 support
- case insensitive sorting (still is not sorting non ACSII names well)
---- Files affected:
vfmg:
vfmg (1.73.2.21 -> 1.73.2.22)
---- Diffs:
================================================================
Index: vfmg/vfmg
diff -u vfmg/vfmg:1.73.2.21 vfmg/vfmg:1.73.2.22
--- vfmg/vfmg:1.73.2.21 Tue Nov 1 12:40:51 2005
+++ vfmg/vfmg Tue Nov 1 15:49:45 2005
@@ -37,11 +37,20 @@
my $o_output;
$defopt{xterm}="$ENV{'VFMG_TERM'}" if $ENV{'VFMG_TERM'};
+my @wms = qw(DR17 aewm afterstep blackbox enlightenment fbpanel fluxbox fvwm
+ fvwm2 icewm metisse openbox olvwm qvwm wmaker wmaker-old xfce4 xpde);
+
+# %destdir and %iconsdir should only contain directories propsed by WM
my %destdir = (
+ DR17 => "$ENV{'HOME'}/.e/e/applications/favorite",
afterstep => "$ENV{'HOME'}/GNUstep/Library/AfterStep/start",
enlightenment => "$ENV{'HOME'}/.enlightenment/menus",
xpde => "$ENV{'HOME'}/.xpde/Start Menu/Programs",
);
+my %iconsdir = (
+ DR17 => "$ENV{'HOME'}/.e/e/applications/all",
+ enlightenment => "$ENV{'HOME'}/.enlightenment/icons",
+);
Getopt::Long::Configure("bundling");
GetOptions(
@@ -71,9 +80,6 @@
'destdir|D=s' => \$opt{destdir},
);
-my @wms = qw(aewm afterstep blackbox enlightenment fbpanel fluxbox fvwm fvwm2
- icewm metisse openbox olvwm qvwm wmaker wmaker-old xfce4 xpde);
-
if($o_help) { # {{{
local $" = ", ";
print<<EOF;
@@ -166,6 +172,9 @@
# check dependencies
$opt{exec}=1 if $opt{exec_full};
+if ( grep { $o_output eq $_ } keys %iconsdir ) {
+ $opt{icons_dir} = $iconsdir{$o_output} unless (length $opt{icons_dir});
+}
if ($opt{icons_scale}) {
if ( length $opt{icons_dir} ) {
my $conv = (split /\s/, $opt{convert})[0];
@@ -391,7 +400,7 @@
$tags{Exec} =~ s/([^%])%i/$1$iicon/g;
$tags{Exec} =~ s/%(?i:[fudn])//g;
warn "Unknown Exec parameter variable: $1 in $File::Find::name, removing\n"
- if ($tags{Exec} =~ s/(%[^%\s])//);
+ if ($o_verbose and $tags{Exec} =~ s/(%[^%\s])//);
$tags{Exec} =~ s/%%/%/g;
push @happs, $File::Find::name;
@@ -408,6 +417,7 @@
open F_IN, "$tmp/applications.menu" or next;
local $/ = undef;
($file = <F_IN>) =~ y/ \t\r\n//d;
+ $file =~ s/<!--.*?-->//g;
close F_IN;
last;
}
@@ -699,6 +709,7 @@
local $/ = undef;
($ok = <F_IN>) =~ y/ \t\r\n//d;
close F_IN;
+ $ok =~ s/<!--.*?-->//g;
$file = $ok . $file;
last;
}
@@ -795,8 +806,63 @@
$level="";
sub cmpdname {
- return $desktop{$a}[1] cmp $desktop{$b}[1];
+ return lc($desktop{$a}[1]) cmp lc($desktop{$b}[1]);
}
+
+sub DR17 { # {{{
+ my ($no, $dir, $tab)=@_;
+ my $sort = 1;
+ my $apps = "";
+ my @edje = qw(edje_cc -id . -fd . icon.edc);
+ foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
+ my $d = $desktop{$entry};
+ $name = $$d[LOCALENAME];
+ print $tab.$name."..";
+
+
+ my $icon = $$d[ICON];
+ $icon = "blank.xpm" unless $icon;
+ $icon = scale_icon($icon);
+ die "No icon $icon\n" unless -r $icon;
+ unlink "/tmp/icon.$opt{icons_ext}";
+ symlink $icon, "/tmp/icon.$opt{icons_ext}";
+ die "No icon /tmp/icon.$opt{icons_ext}\n" unless -r "/tmp/icon.$opt{icons_ext}";
+ print "..";
+
+
+
+ if($menu[$no]{$entry} < 0) {
+ my $file = "$opt{icons_dir}/$$d[FILENAME].eap";
+
+ system(@edje,$file);
+ print "..";
+ system("enlightenment_eapp",$file,
+ "-set-name",$name,
+ "-set-generic",$name,
+ "-set-exe",$$d[EXEC]);
+ print "..DONE\n";
+ $apps .= $$d[FILENAME] . ".eap\n";
+ } else {
+ my $subdir = sprintf "%s/%.2d_%s", $dir, $sort, $$d[FILENAME];
+ my $file = $subdir . "/.directory.eap";
+ mkpath($subdir,0,0700);
+ print "..";
+ system(@edje, $file);
+ print "..";
+ system("enlightenment_eapp",$file,
+ "-set-name",$name,
+ "-set-generic",$name);
+
+ print "..DONE\n";
+ DR17($menu[$no]{$entry},$subdir,$tab."\t");
+ $sort++;
+ }
+ }
+ open F_OUT, ">> $dir/.order" or warn "$dir/.order: $!\n";
+ print F_OUT $apps;
+ close F_OUT;
+} # }}}
+
sub icewm { # {{{
my $no=$_[0];
my $apps="";
@@ -1197,6 +1263,43 @@
}
# WM case {{{
+if ( $o_output eq "DR17" ) { # {{{
+ die "Enlightenment DR17 requires icons scaling\n"
+ unless $opt{icons_scale};
+ $| = 1;
+ print "Generating DR17 menu, this may take a long time\n";
+ chdir("/tmp");
+ # icon is allways neaded
+ open F_OUT, "> blank.xpm"; # {{{
+ print F_OUT <<EOF;
+ static char *blank[] = {
+ "1 1 1 1",
+ ". c None",
+ "."
+ };
+EOF
+ close F_OUT; # }}}
+ open F_OUT, "> icon.edc"; # {{{
+ print F_OUT << "EOF";
+ images { image: "icon.$opt{icons_ext}" COMP; }
+ collections { group {
+ name: "icon";
+ max: 48 48;
+ parts { part {
+ name: "image";
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ aspect: 1.0 1.0;
+ image.normal: "icon.$opt{icons_ext}";
+ } } } } }
+EOF
+ close F_OUT; # }}}
+ DR17($opt{strip},$opt{destdir},"");
+ unlink "blank.xpm";
+ unlink "icon.edc";
+ exit;
+} # }}}
if($o_output eq "icewm") {
icewm($opt{strip});
exit;
@@ -1276,14 +1379,14 @@
fbpanel($opt{strip});
exit;
}
-if($o_output eq "openbox") { # {{{
+if($o_output eq "openbox") {
print "<openbox_menu>\n" unless $opt{nomenu};
print qq(<menu id="root-menu" label="PLD Linux">\n) unless $opt{nomenu};
openbox($opt{strip});
print "</menu>\n" unless $opt{nomenu};
print "</openbox_menu>\n" unless $opt{nomenu};
exit;
-} # }}}
+}
# WM case }}}
# vi: ts=4 sw=4 noet fdm=marker
================================================================
---- CVS-web:
http://cvs.pld-linux.org/vfmg/vfmg?r1=1.73.2.21&r2=1.73.2.22&f=u
More information about the pld-cvs-commit
mailing list