diff --git a/xfce-xterm-launcher-log-age b/xfce-xterm-launcher-log-age index 1b1048c..4b04980 100755 --- a/xfce-xterm-launcher-log-age +++ b/xfce-xterm-launcher-log-age @@ -16,11 +16,26 @@ mkdir "$ENV{HOME}/log/"; mkdir "$ENV{HOME}/log/xfce-xterm-launcher/"; open my $log, ">>", "$ENV{HOME}/log/xfce-xterm-launcher/" . strftime("%Y-%m", localtime); +my @dirs = ("$ENV{HOME}/bin/hosts", + grep -d, glob("$ENV{HOME}/bin/hosts/*")); + my $i = 0; for (@desktop_files) { my $content = read_file($_); my ($exec) = $content =~ m/^Exec=xterm -e (.*)/m; next unless defined $exec; - my $age = -A "$ENV{HOME}/bin/hosts/$exec"; + my $age = age($exec); say $log join("\t", $^T, ++$i, $exec, $age); } + +sub age { + my ($exec) = @_; + if ($exec =~ m{^/}) { + return -A $exec; + } + for my $d (@dirs) { + my $age = -A "$d/$exec"; + return $age if defined $age; + } + return; +} diff --git a/xfce-xterm-launcher-update b/xfce-xterm-launcher-update index 6591d54..704b733 100755 --- a/xfce-xterm-launcher-update +++ b/xfce-xterm-launcher-update @@ -6,8 +6,6 @@ use strict; use File::Slurp; use Data::Dumper; -use experimental qw(autoderef); - my $launcher = $ARGV[0]; my $verbose = 0; @@ -22,7 +20,9 @@ for (@desktop_files) { $desktop_files{$name} = { name => $name, filename => $_, content => $content } } -my @xterm_scripts = glob("$ENV{HOME}/bin/hosts/*"); +my @xterm_scripts = grep !-d, + (glob("$ENV{HOME}/bin/hosts/*"), + glob("$ENV{HOME}/bin/hosts/*/*")); @xterm_scripts = sort { -A $a <=> -A $b } @xterm_scripts; @xterm_scripts = @xterm_scripts[0..31] if @xterm_scripts > 32; for my $xterm_script (@xterm_scripts) {