This script logs to a file the name of the active windows, so you can keep track of how much time you spend on each activity. It logs only the current session, if you modify it, please post the results :-) If you use firefox, you need to install the "nightly tester tools" adddon to change the title of the window to "firefox", otherwise the script will keep track of each url visited. Currently I embed the resulting text file in conky, it updates only each minute, to prevent writing too often to the disk; maybe there is a way to "pipe" the results to conky.
use feature ':5.10'; # loads all features available in perl 5.10 use IPC::System::Simple qw(system systemx capture capturex); while (1) { $comando = q(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| cut -d ' ' -f + 5); $output = capture("$comando"); chomp $output; $titolo = q(xwininfo -id ) . $output . q( |awk 'BEGIN {FS="\""}/xwininfo: Window id/{print $2}' | sed + 's/-[^-]*$//g'); $outTitolo = capture("$titolo"); chomp $outTitolo; sleep 60; if ( $outTitolo =~ /firefox/gsi ) { $outTitolo = 'firefox'; } push( @myNames, $outTitolo ); my %hashActivity = count_unique(@myNames); undef my $oreTotali; while ( my ( $key, $value ) = each(%hashActivity) ) { $oreTotali = $value + $oreTotali; } open FILE, ">.activityLog.txt" or die $!; print FILE " $oreTotali minuti Uptime "; foreach $key ( sort { $hashActivity{$b} <=> $hashActivity{$a} } keys %hashActivity ) { $percentualeOre = int( $hashActivity{$key} / $oreTotali * 100 +); print FILE "\n $hashActivity{$key}\' $key\n "; for ( 0 .. $percentualeOre / 10 ) {print FILE "=="} print FILE " $percentualeOre \%"; } print FILE "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; } sub count_unique { my @array = @_; my %count; map { $count{$_}++ } @array; #print them out: # map {print "$_ = ${count{$_}}\n"} sort keys(%count); #or just return the hash: return %count; }

In reply to here is a script to log what you do during the day... by gianni

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.