[Unix] Logging your work using suckless dwm

I'm a huge fan of suckless dwm. This is the simplest possible (tiling) window manager for Unix, with some nostalgic flavor of MS-DOS and pre-Windows GUIs of 1990's. It's main advantage is that is offers no distractions at all.

After dwm, Gnome/KDE/macOS/Windows is like working sitting in the middle of crowdy pub during major football event. Or being in the middle of noisy Xmas fare. (You can have fun there, but these are wrong places to focus on work.)

This is my patch for dwm 6.3 that enables logging. Example of log you can see here. Basically, window titles are logged prefixed by date/time (and Unix timestamp).

The patch is small and can be backported to any dwm version.

Now let's see, what websites I visited most?

% cat dwm* | sort | uniq | grep Mozilla | cut -d ' ' -f4- | sort | uniq -c | sort -n

(More examples in my blog on 'uniq -c' usage: 1, 2, 3, 4.)

Some entries are censored, sorry:

...
    184 Music - YouTube — Mozilla Firefox
    190 cryptography — Mozilla Firefox
    193 Новости — Mozilla Firefox
...
    199 Your turn - Play Ghotu • lichess.org — Mozilla Firefox
    203 Play Ghotu • lichess.org — Mozilla Firefox
...
    226 Dennis Yurichev's blog — Mozilla Firefox
...
    266 RuTracker.org — Mozilla Firefox
    267 Discord | Your Place to Talk and Hang Out — Mozilla Firefox
...
    273 Home / Twitter — Mozilla Firefox
...
    328 Yurichev's discourse - Reverse engineering, crypto, math, CS, SAT, SMT, geeks — Mozilla Firefox
...
    411 YouTube — Mozilla Firefox
    425 Problem loading page — Mozilla Firefox
    427 general-chat — Mozilla Firefox
    439 yurichev (u/yurichev) - Reddit — Mozilla Firefox
    455 Twitter — Mozilla Firefox
    518 Discord — Mozilla Firefox
    603 Трекер — Mozilla Firefox
    731 Analysis board • lichess.org — Mozilla Firefox
...
   1216 PDF.js viewer — Mozilla Firefox
   1518 Library Genesis — Mozilla Firefox
   2173 Facebook — Mozilla Firefox
   2175 OpenStreetMap — Mozilla Firefox
   3524 lichess.org • Free Online Chess — Mozilla Firefox
  43969 Mozilla Firefox
What I read in Wikipedia during last month?
...
     19 Finite field - Wikipedia — Mozilla Firefox
     19 List of fallacies - Wikipedia — Mozilla Firefox
     20 Chinese remainder theorem - Wikipedia — Mozilla Firefox
     20 Greek alphabet - Wikipedia — Mozilla Firefox
     20 Mikhail Gorbachev - Wikipedia — Mozilla Firefox
     21 Addition-chain exponentiation - Wikipedia — Mozilla Firefox
     21 Emacs - Wikipedia — Mozilla Firefox
     21 QR code - Wikipedia — Mozilla Firefox
     21 Stonehenge - Wikipedia — Mozilla Firefox
     21 UTF-8 - Wikipedia — Mozilla Firefox
     22 Coppersmith's attack - Wikipedia — Mozilla Firefox
     22 Inside No. 9 - Wikipedia — Mozilla Firefox
     23 Modular arithmetic - Wikipedia — Mozilla Firefox
     23 SHA-2 - Wikipedia — Mozilla Firefox
     24 Birthday attack - Wikipedia — Mozilla Firefox
     24 CLMUL instruction set - Wikipedia — Mozilla Firefox
     24 ElGamal signature scheme - Wikipedia — Mozilla Firefox
     24 HMAC - Wikipedia — Mozilla Firefox
     25 The Incredible Machine - Wikipedia — Mozilla Firefox
     26 Block cipher mode of operation - Wikipedia — Mozilla Firefox
     26 Modular multiplicative inverse - Wikipedia — Mozilla Firefox
...
     28 Exponentiation by squaring - Wikipedia — Mozilla Firefox
     29 2022 Russian invasion of Ukraine - Wikipedia — Mozilla Firefox
     30 Wikipedia, the free encyclopedia — Mozilla Firefox
     33 Cyclic redundancy check - Wikipedia — Mozilla Firefox
     33 d20 System - Wikipedia — Mozilla Firefox
...
     42 Galois/Counter Mode - Wikipedia — Mozilla Firefox
     43 Digital Signature Algorithm - Wikipedia — Mozilla Firefox
     48 Dice - Wikipedia — Mozilla Firefox
...

Likewise, you can see, what text files you edit most of the time [in your favorite text editor]. What videos you watched on YouTube, and how often.

Likewise, having a media player, you can gather statistics about your most favorite songs.

I also have a script (which is too ugly) which count, how many hours I spent today (my personal daily uptime). If too much (>X hours), a warning issued. You can do this using the 'uptime' command, but idle time must be subtracted somehow.

You can also see how focused you are, in a specific day. What distracts you too often? (More fussiness -> more entries in dwm log that takes too small amount of time. I.e., you switch between windows too fast, and this is bad for productivity, obviously.)

All dwm log entries are grepable.

There is a big potential for personal analytics and analysis of your work habits. For ideas, read Stephen Wolfram's blog post.

BTW, after reading S.Wolfram's post, I also managed to caputre a screenshot each minute, which I can also 'grep'.

A bug in my patch - 'title' entries are added twice. I don't know why. Too lazy to investigate. Run 'sort | uniq' to mitigate this problem (like I do).

Also, fix path to logs in my patch.


Another thing to say about dwm. I never understood why dwm developers use Alt, because shortcuts like Alt-1 are in demand in other software, like Firefox.

So my choice is to use Winkey instead of Alt in dwm.

(the post first published at 20221114, updated 20240510.)


List of my other blog posts.

Subscribe to my news feed

Yes, I know about these lousy Disqus ads. Please use adblocker. I would consider to subscribe to 'pro' version of Disqus if the signal/noise ratio in comments would be good enough.