added xfce-xterm-launcher-log-age

This commit is contained in:
Peter J. Holzer 2014-11-12 12:00:37 +01:00
parent 3af08cce5e
commit 8d8a223612
2 changed files with 29 additions and 1 deletions

View File

@ -1,6 +1,9 @@
all:
install: $(HOME)/bin/xfce-xterm-launcher-update
install: \
$(HOME)/bin/xfce-xterm-launcher-update \
$(HOME)/bin/xfce-xterm-launcher-log-age \
$(HOME)/bin/%: %
cp $^ $@

25
xfce-xterm-launcher-log-age Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/perl
use warnings;
use strict;
use File::Slurp;
use Data::Dumper;
use v5.10;
use POSIX qw(strftime);
my $launcher = $ARGV[0];
my $launcher_dir = "$ENV{HOME}/.config/xfce4/panel/launcher-$launcher";
my @desktop_files = glob("$launcher_dir/*.desktop");
mkdir "$ENV{HOME}/log/xfce-xterm-launcher/";
open my $log, ">>", "$ENV{HOME}/log/xfce-xterm-launcher/" . strftime("%Y-%m", localtime);
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";
say $log join("\t", $^T, ++$i, $exec, $age);
}