waimea - Hintergrund per menü ändern

r2d2

Well-Known Member
Hallo,

ich möchte gerne mein Hintergrundbild per waimeamenü wechseln sobald ein neues Pic in einem Verzeichnis ist und das auch gleich angezeigt wird im Menü.

Mit den waimea styles funktioniert das schon von anfang an.Sobald man ein neues Style im Verzeichnis ablegt, taucht das auch schon im Menü auf.Das skript dazu sieht so aus:
Code:
#!/usr/bin/perl -w
use POSIX;

my $title = "styles";
my $stylesdir = "/usr/X11R6/share/waimea/styles";
my $homestylesdir = "$ENV{HOME}/.waimea/styles";
@Styles = ();

if (! $ARGV[0]) {
    print_directory($stylesdir);
    print_directory($homestylesdir);
}
else {
    print_directory($ARGV[0]);
}

if (@Styles) {
    print "[title] ($title)\n";
    foreach $Style (@Styles) {
       print $Style;
    }
}                                                                     

sub print_directory {
	my $mode;
	my $temp;
	my @dir_list;

	opendir(DIR, $_[0]) || die "can't opendir $_[0]: $!";
	@dir_list = grep { /^[^\.].*/ || /^\.\..*/} readdir(DIR);
	closedir DIR;

	while ($temp = shift @dir_list) {
		$mode = (stat("$_[0]\/$temp"))[2];
		if (!($temp eq '..' || $temp eq '.')) {
			if (S_ISDIR($mode)) {
				print_directory("$_[0]\/$temp");
			} else {
				if (S_ISREG($mode)) {
					$_ = $temp;
					if (/(.+)\.style$/) {
						$Item = "[item] ($1) \"restart(waimea --stylefile=" .
							"$_[0]\/$temp)\"\n";
						push(@Styles, $Item);
					}
				}
			}
		}
	}
	return 0;
}

Das ganze wird im menü aufgerufen mit : [sub] (Styles) <!stylesdir.pl>

Das selbe müsste doch funktionieren mit einem Hintergrundbild wechseln? oder bin ich da auf dem Holzweg.....Ich hab es geschaft das mir die Bilder im menü schon angezeigt werden, aber es funzt leider nicht.Das ganze sieht so aus:
Code:
#!/usr/bin/perl -w
use POSIX;

my $title = "Background";
my $stylesdir2 = "/usr/X11R6/share/waimea/backgrounds";
my $homestylesdir2 = "$ENV{HOME}/.waimea/background";
@Styles2 = ();

if (! $ARGV[0]) {
    print_directory($stylesdir2);
    print_directory($homestylesdir2);
}
else {
    print_directory($ARGV[0]);
}

if (@Styles2) {
    print "[title] ($title)\n";
    foreach $Style2 (@Styles2) {
       print $Style2;
    }
}                                                                     

sub print_directory {
	my $mode;
	my $temp;
	my @dir_list;

	opendir(DIR, $_[0]) || die "can't opendir $_[0]: $!";
	@dir_list = grep { /^[^\.].*/ || /^\.\..*/} readdir(DIR);
	closedir DIR;

	while ($temp = shift @dir_list) {
		$mode = (stat("$_[0]\/$temp"))[2];
		if (!($temp eq '..' || $temp eq '.')) {
			if (S_ISDIR($mode)) {
				print_directory("$_[0]\/$temp");
			} else {
				if (S_ISREG($mode)) {
					$_ = $temp;
					if (/(.+)\.jpg$/) {
						$Item = "[item] ($1) \"restart(waimea --stylefile=" .
							"$_[0]\/$temp)\"\n";
						push(@Styles2, $Item);
					}
				}
			}
		}
	}
	return 0;
}

Mir sagen die ganzen zeigen gar nix, mich wunderts das ich es geschaft hab, das es mir schonma die Pic´s (jpg) automatisch anzeigt im menü.Bin für jede Hilfe Dankbar!

MfG
 
Back
Top