Time-lapse photo by Rudolf Kirchner

Automatic time-tracking for the lazy

I’ve just become a father — which is awesome! And I work for a great company (Mantel Group / DigIO) which has gone above and beyond to support our new family. So what does this have to do with time-tracking?

Who loves time-tracking? Not me.

DigIO is a leading IT consultancy in Australia, and I need to track the time I spend on different projects and activities. But here’s the thing:

I find time-tracking INCREDIBLY booooooring (don’t tell my boss).

Consequently, I often find myself estimating how much time I spent on projects, rather than diligently recording how I’ve spent every minute of the day. Now, if you’re an accountant who happens to be reading this piece, you probably don’t understand why I don’t enjoy recording how I’ve spent every minute of the day. For everyone else, you will understand that recording everything manually is a chore.

The thought occurred to me while working out-of-the-office on paternal leave, “Why not automatically track your time?” So, using the fractions-of-spare-time I’ve had, I’ve put together a simple Node program to do just that…

Introducing "active-win-log"

active-win-log is a program records which window is in the foreground of your computer-desktop every 5 seconds. Then, when you want to know what your usage has been over the last few days, you can get a lovely report showing the hours:minutes:seconds of usage, grouped by day, program and window/tab:

Oooooh, colours!

Now I don’t have to estimate how long I’ve been programming, or determine how much browser-time was for work (and how much was for “not-work”).

Caveat Emptor

Here’s what the program does not do:

  • It doesn’t input data into your time-tracking tool. That would be awesome, but there’s a bazillion time-tracking tools out there and I have no time to support them all. Sorry (not sorry).
  • It doesn’t track time away from your computer. That would require a drone or a network of cameras to watch you continuously, and determine whether the activity you are performing is considered “work” or not. Maybe the AI team at Eliiza could look into that…
  • It cannot determine whether you are actually using a program, or have simply gone to the toilet while the program is active.

In summary, the tool can be used to give you a reasonable estimate of the time spent using each application, but it’s not gospel-truth.

How it works

Once installed, the program can be started by typing awl in your terminal window. Now, normally when you start a terminal program it keeps running until it finishes it’s task. But if the task is, “monitor application windows FOREVER”, you would be forgiven for thinking that once you start active-win-log, it will keep running in that terminal window and never allow you to type another command until you kill the process.

But there is another type-of-program in computer science called a daemon…

Matt Damon, not to be confused with a daemon.

…which can offer a much better user experience. A daemon is a kind of computer program which runs in the background rather than requiring interaction with the computer-user. active-win-log is written as a daemon, but it also allows you to interact with it as-though it were an ordinary program too. Which is kind of neat!

This was my first time writing a daemon program. If you are interested, you can take a look at the source code. You will probably find a bunch of things that could be improved — pull requests are always welcome (just follow the guidelines in CONTRIBUTING.md). Bear in mind that I was sleep-deprived and trying to look after a crying baby while writing it. I took inspiration from laravel-logwatch which uses the same Node daemon library, daemonize-process. The project also uses the active-win module by Sindre Sorhus to detect the active window.




Life = Faith + Family + Others + Work + Fun, Work = Software engineering + UX + teamwork + learning, Fun = travelling + hiking + games + …

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

CS 373 Fall 2021: Blog #9

The Truth On Trump’s Recent Firing Of My Wife

Why hackathons are alarmingly ubiquitous (and why you should attend one)

Overview of GIT Version Control System

Three Ds

A Guide for Transferring Google Chrome Tabs Between iPhone, iPad, and Mac

Journey#01: HTML & CSS

Review of Vimeo OTT: The Best Vimeo OTT Alternatives & Competitors For 2022

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Brett Uglow

Brett Uglow

Life = Faith + Family + Others + Work + Fun, Work = Software engineering + UX + teamwork + learning, Fun = travelling + hiking + games + …

More from Medium

Blender vs Maya, A Starters Dilemma

Why We Migrated To pnpm

Lets change phone browser

How can you deliver a variety of images in different formats on a high-traffic site in real time?

Example of the same image in different size on the site