linux-desktop-audit

linux-desktop-audit (formally gnome-workspacetime)

Auditing your activities on your Gnome desktop. Also supports KDE, and I expect, any desktop with wnck and d-bus. This can be used to automatically generate timesheets for your computer related activities.

Introduction

The purpose of this page is to briefly describe the 'linux-desktop-audit' program which I have written. This program (currently) consists of two components: one component which runs in the background and listens to the window manager and desktop 'linux-desktop-audit-daemin.py'. 'linux-desktop-audit-daemon.py' is listening for:

    • changing workspace

    • changing active windows

    • screensaver starting or stopping

    • window name changes

A second component 'linux-desktop-audit.py' generates a visualization from the auditing data which 'linux-desktop-audit.py' collects. A screenshot of the visualisation is below. For simplicity, the term linux-desktop-audit is used on this page to include both components of the software system.

Purpose

linux-desktop-audit is an application to help me understand where I spend my time during my working day. I have a number (~6) workspaces each of which I use to perform different tasks. For example, I 'm currently on the 'email/browser' workspace. I go here when I wish to check my work or personal email, maybe read a bit of LWN.net and generally be interrupted. Another workspace is called 'Database'. On here, I also have a browser, but I also have a bunch of terminals open. When I go there, I'm working on work. This program is also useful if you need to produce timesheets accounting for your time.

linux-desktop-audit has been developed with myself in mind: I want to know how much time I'm spending on each of my given workspaces, and what I'm doing when I'm on them.

Screenshot

I love screenshots!

Version 0.7 (or so) introduces a spreadsheet view.

version 0.4.3: the new 'trends' view (below) and the new 'stats' view (above). A new pallet has been introduced, based on the Tango pallet.

version 0.4.1: this is like version 0.4.0 but with multiple bugs fixed. Indeed you should be able to see that the same database file is used...

version 0.4:

The image labeled 'version 0.4' shows data which I have accumulated over 5 days. Days run in the y-axis, from right to left we have today, yesterday, t-2, t-3, t-4. Time during the day runs from the bottom (12 midnight) to top (12 midnight). 12 noon is half way up. Regions of light grey should probably be coloured in dark grey (screensaver) (see known issues below). There is a key on the top right.

version 0.3

The screenshot above is what you see if you 'tail -f ' the file which the daemon is logging to. And then put it through GIMP to re-touch it. The latests version outputs the log results into a (sqlite3) relational database.

Practically, a more useful output example is provided by a dump for an example sql audit file (although this is out of date now):

sqlite> select * from lda2_workspace_audit;

1|2009-06-25 19:27:42|2009-06-25 19:27:43|0.119224071503|24|

2|2009-06-25 19:27:52|2009-06-25 19:27:53|0.047119140625|24|

3|2009-06-25 19:27:52|2009-06-25 19:27:55|2.55625700951|Desk 2|

4|2009-06-25 19:27:55|2009-06-25 19:27:56|0.49994301796|Desk 3|

5|2009-06-25 19:27:55|2009-06-25 19:28:23|27.7879049778|Desk 2|

6|2009-06-25 19:28:23|2009-06-25 19:28:38|14.8596000671|Desk 1|

7|2009-06-25 19:28:38|2009-06-25 19:38:48|609.970273972|Desk 2|

8|2009-06-25 19:38:48|2009-06-25 19:38:51|2.3328139782|Desk 1|

9|2009-06-25 19:38:50|2009-06-25 19:48:06|555.815879107|Desk 2|

10|2009-06-25 19:48:06|2009-06-25 20:05:45|1058.60643506|Desk 1|

sqlite> select * from gwst1_windowname_audit limit 10;

1|2009-06-25 19:27:52|2009-06-25 19:28:06|13.0399799347|richard@richard-laptop: ~|5

2|2009-06-25 19:28:05|2009-06-25 19:28:06|0.0964930057526|richard@richard-laptop: ~/workspacetime|5

3|2009-06-25 19:28:05|2009-06-25 19:28:31|25.4828941822|Subscription request confirmed - Mozilla Firefox|13

4|2009-06-25 19:28:31|2009-06-25 19:49:55|1283.83280396|xxx | http://yyy.. - Skype™ Chat|27

5|2009-06-25 19:49:55|2009-06-25 19:52:33|157.79581213|Compose Mail - 'Yahoo! Mail' - Mozilla Firefox|32

6|2009-06-25 19:52:33|2009-06-25 19:52:35|1.87411999702|sqlite3 commands - Google Search - Mozilla Firefox|32

7|2009-06-25 19:52:34|2009-06-25 19:52:45|10.4762248993|xxx | http://yyyy.. - Skype™ Chat|33

8|2009-06-25 19:52:44|2009-06-25 19:54:01|76.0426309109|hotel xxx - Google Maps - Mozilla Firefox|36

9|2009-06-25 19:54:00|2009-06-25 19:54:10|9.07197213173|Compose Mail - 'Yahoo! Mail' - Mozilla Firefox|36

10|2009-06-25 19:54:10|2009-06-25 19:54:39|28.7222120762|xxx | http://yyyy.. - Skype™ Chat|37

sqlite> select * from gwst1_window_audit limit 10;

1|2009-06-25 19:27:52|2009-06-25 19:27:55|2.66967010498|File Manager|3

2|2009-06-25 19:27:55|2009-06-25 19:27:56|0.445926189423|Terminal|4

3|2009-06-25 19:27:56|2009-06-25 19:28:01|4.94491887093|Terminal|4

4|2009-06-25 19:28:00|2009-06-25 19:28:01|0.114999055862|Terminal|4

5|2009-06-25 19:28:00|2009-06-25 19:28:01|0.766232013702|Terminal|4

6|2009-06-25 19:28:01|2009-06-25 19:28:24|22.0834841728|File Manager|5

7|2009-06-25 19:28:23|2009-06-25 19:28:25|1.82799506187|Firefox|5

8|2009-06-25 19:28:25|2009-06-25 19:28:26|0.72123003006|File Manager|5

9|2009-06-25 19:28:25|2009-06-25 19:28:27|1.21301102638|Firefox|5

10|2009-06-25 19:28:27|2009-06-25 19:28:28|0.27173781395|Firefox|5

sqlite>

Details of the database schema are included in with the code. However, it is currently poorly documented.

Usage

Both 'linux-desktop-audit.py' and 'linux-desktop-audit.py' contain helpful detail of usage, but here they are to save you the effort of downloading it...

linux-desktop-audit-daemon.py -h

Usage: The purpose of this program is to

log the time and date of events on the desktop.

Events which are logged include:

Workspace switches

Activive window switched

Window name changes

Screensaver start/stop

The buses which are watched for these events are:

dbus (screensaver)

wnck (everything else)

This program has only been tested on Gnome2. Because of the

dependence on wnck, it is not expected to work on any other platform.

This program is designed to run as a daemon and will fork (Unix) into

the background when it is started.

Options:

-h, --help show this help message and exit

-d OUTPUTDBFILE, --outputdb=OUTPUTDBFILE

append the events to this sqlite db.

-i, --initdb initialise the database file.

-n, --windownames also log window names.

linux-desktop-audit.py -h

Usage: Plot the auditing data.

Options:

-h, --help show this help message and exit

-d INPUTDBFILE, --inputdb=INPUTDBFILE

read the data from this sqlite db.

Known Problems

    • Times are recorded as GMT - the presentation layer should adapt this to localtime.

Release

Because I've moved to Gitorious, you should check the logs there to see progress. I don't always get around to updating this page....

I've moved the code to 'gitorious' and changed the licence to GPLv3.

http://gitorious.org/linux-desktop-audit/linux-desktop-audit

The current version of this software is available under GPLv2 or later.

PRIVACY: this code has the potential to invade your privacy, particularly if you enable: 'logging window names'. Some applications (evolution) will include the subject of an email address in the window title. Firefox window names include the title of the page you are browsing.

0.5.1 2009/12/03 code is now hosted on Gitorious (see above)

  • Fixed 'bug in auditing' from previous version

  • Fixed a bug during startup.

  • Reorganised schema (this version is not backward compatible).

  • New statistics page.

BUG IN AUDITING. THIS EFFECTS ALL VERSIONS PRIOR TO 0.5: I have discovered a problem in the method of logging events to the SQLite3 DB. The problem occurs because I am watching two different buses for events, but expecting events from the buses to arrive at my code in the order they take place in real time. However, it is possible, if one bus is busy or events arrive very quickly, that events from one bus could 'over-take' the other buses events and arrive out of order. Since the two buses are for window (WNCK) events and screensaver (DBUS) events, the problem typically occurs when I events arrive from both of them at about the same time - which only practically happens when screensaver is disabled.

The bug has the effect of recording incorrect times and durations of audit events around the time the screensaver is disabled.

A fix for this bug required significant changes to the daemon and storage schema. This has been completed and I'm currently reworking the dependent (GUI) code to work with the new version.

Version 0.4.3

Changes:

        • New visualisation modes: trends and statistics.

        • Zoom feature included on timeline views.

        • New Tango palette, which makes things look nicer.

        • External configuration file to help individual customisations.

        • Minor performance improvements with timeline view.

Known Issues:

        • There are some minor bugs.

Version 0.4.1

Changes:

        • Multiple bug fixes within the GUI.

        • GUI improvements: axis improvements etc.

Known Issues:

        • There is much more data collected by the daemon than is rendered by the visualising code.

Version 0.4.0

Changes:

        • Updated Sqlite3 schema - this makes version 0.4.0 incompatable with data recorded by 0.3.0

        • Some bug fixes in the daemon and sqlite_handler.py.

        • Added first version of visualiser code.

Known Issues:

        • The visualisation code leaves alot to be desired.

        • There is much more data collected by the daemon than is rendered by the visualising code.

Version 0.3.0

Known issues: All this daemon does is to create and populate a database with desktop auditing information. For this to be practically useful, some 'value-added' products should be produced from this database. This could be statistics or visualisations.

Target

The ultimate target for this project is for inclusion into Gnome so that users of all abilities can choose to monitor their time while using their computer.

Dependencies

This code is written in python. It uses DBUS and WNCK to listen for workspace events. It uses Sqlite3 to store the auditing information.

Closing

I welcome feedback, you can email me at the address below.

rjhenwood a_t yahoo co uk