Time tracking with timewarrior

I’ve been working from home for a bit more than a month – or, as we say around here, “doing home office”, which is apparently a typically German turn of phrase 😉 Since I’m working part-time (60%), and days and hours tend to melt into each other, actually tracking the time that I spend working has proven pretty useful for me to dose the “right” amount of work: make sure I’m working the hours I’m supposed to work, make sure I’m not working significantly more than the hours I’m supposed to work. For those who know me a little, they’ll have an inkling that my issue is more the latter one than the former, with me being much more worried about the former than the latter 😉

I had done that sort of tracking a long while ago with some software called arbtt. It was fairly neat when it came to automating that tracking (and that’s why I’m mentioning it here explicitly): it uses the mouse focus to determine on which window you are working, identifies said windows by their titles, and allows to define rules to classify which belongs to what. I ran that thing for a while when I was working as a freelancer, and that worked pretty well – if you’re not allergic to Haskell. (My window manager is in Haskell too, so I can survive :p )

This time around, I didn’t feel the need to fight with arbtt rule system to fit everything into categories that would be too fine-grained for my liking; after a bit of poking, I found timewarrior. There’s a package on my Ubuntu, so I just installed it, and I started tracking.

In timewarrior, you track by associating tags to intervals of time. For instance, when I start working on documentation, I open a terminal and type

$ timew start work doc

and it starts an interval tagged with work and doc. I have a very coarse set of tags: my current tags are doc (writing documentation), qa (helping our QA department with testing our software), meeting (daily and weekly status meetings, mostly) and social (when I’m socializing with colleagues, not necessarily being productive per se, although such discussions are very often fruitful). To that, I add a generic work tag to these all categories except social, so that I can easily tally my whole work hours. I’m not actively developing these days, but when that comes back, I’ll handle tags for that as well. I also track lunch when I go for my lunch break 😉

Whenever I start a new interval, it automatically closes the previous one – so if I switch from timew start work doc to timew start lunch, the interval lunch starts, and the interval work/doc is closed. If I want to stop the current interval without starting a new one (typically at the end of the day), I just go

$ timew stop

and no interval is running anymore.

To display what’s been logged so far, timew summary is the way to go. I actually experimented with tracking my Sunday yesterday, and if I want to know how long I spent cooking, I can look at my cuisine tag that way:

[isa@wayfarer ~]$ timew summary :yesterday cuisine

Wk  Date       Day Tags       Start      End    Time   Total
W17 2020-04-26 Sun cuisine 11:28:00 11:59:00 0:31:00
                   cuisine 18:04:59 18:28:09 0:23:10
                   cuisine 18:44:23 19:05:10 0:20:47 1:14:57
                                                            
                                                     1:14:57

It gives me all the instances and a sum of the time I spent overall during the day. This is particularly useful for my work usage: I tag everything I do for work with work, and that allows me to keep track of the amount of work I’ve put in the day.

If I forget to start or stop an activity, it’s trivial to do a posteriori if I’m in an “open” interval, slightly more tricky but still feasible if I need to re-insert things in the middle of other things. Generally speaking, I haven’t found something that I wanted to do that I didn’t find how to yet. The interface can be somewhat clunky, but it’s surprisingly input-flexible (the easy example is that I can do “timew start work doc” or “timew work doc start” or even “timew doc start work” – and it’ll start tracking an activity with tags doc and work in both cases).

The documentation is also very good, allowing both discoverability of features and reference. There’s also ways of getting pretty charts, to export data as JSON, and to develop extensions.

Obviously, if you’re looking for something that synchronizes between several computers, or that you can use on your phone, or or or…. this may not be the software for you. (Although running it somewhere on the internet and tracking via SSH would probably be a viable option). Me, I just want to open a term, type timew start mystuff, close my term, and be done with it – and I don’t care about tracking different things on different computers, because the context of what I’m tracking is different anyway. If your needs align with mine, I can only recommend you have a look at timewarrior 🙂

New monitor, new setup!

I just replaced my 24″ monitor with a new shiny 27″ – 3 more inches in the diagonal, but 4 times more pixels – which required a bit of tinkering – so here’s a bit of a write-up, so that a/ I can share what worked for me and b/ I have something to refer to myself whenever I do that again (I’ll probably have to tinker is some similar ways for the laptop…)

General setup

I have a fairly… personal setup – it DOES work for me, but it’s definitely in the “less common” category, which makes searching for information somewhat more challenging.

  • First things first, obviously: I run Linux, specifically right now Ubuntu 19.04 Disco Dingo – that’s probably the most standard element of my setup.
  • I run it with xmonad/xmobar/dmenu as my user interface.
  • My main screen is now a 27″, 3840×2160 (very pixels, wow)
  • I have a second screen, left of my main one, as a secondary screen, which I mostly use for “browsing documentation when I’m doing something on the main screen” or “chat window when I’m playing in full screen on the main screen”. It’s a 19″, 1280×1024. So, yes, that means multiple-DPI setup – I will admit that the thought had not crossed my mind when I bought the new one. Eh.

So, essentially, this looks like this:

Display configuration

I have a fair amount of things running in the browser, so the first thing I experimented with was changing the scale of the pages of what I was browsing. That went okay on the large screen, but then the scale was completely off for my secondary screen – and switching scale levels depending on the screen would have been a major pain. There is some automated and experimental stuff there; since my setup is already atypical, I decided to not dig much more into why it didn’t work. (I tried. Vaguely.)

I ran into a reasonable solution almost by chance (I didn’t know exactly what I was looking for) here: Configuring mixed DPI monitors with xrandr. I’m now scaling the secondary monitor by a factor of 1.5, which makes it still “good enough for my use” when it comes to the look of the screen (it’s wobbly on my terminal. I can live with that.) and which is “compatible enough with my large screen” when it comes to displaying stuff that’s configured for my large screen.

I’ve been running a “screen setup” script for a long while (which I basically run every time I boot my computer – both on the laptop and on the desktop), so it was a matter of editing the xrandr line to the following:

xrandr --output DVI-D-0 --scale 1.5x1.5 --output DP-2 --pos 1920x0 \
    --mode 3840x2160 --primary 

So from there, I know that whatever I do on the large screen is going to be “good enough” on the secondary screen.

Chrome

Chrome has been a bit of a pain. My first attempt was playing with the default scaling of the rendered web pages and fonts, but the tabs and the UI were still (as expected) super small. I finally found the right flag, specifically --force-device-scale-factor=1.5. As far as I can tell, there’s no way to make that configuration persistent at Chrome level (or, at least, I didn’t find it). And since I’m not starting my browser from an icon or a shortcut or anything like that, I couldn’t set it up there either. I ended up creating a google-chrome launch script in my personal bin directory (which was already setup in front of my PATH, thankfully, otherwise I would have required additional yaks) to pass the flag.

Moreover, the flag worked to scale the UI, but it also re-scaled the web page rendering, so I had to roll back my earlier config attempts. But now everything is fine and I can use Chrome without squinting too much, yay.

The “Save” dialog is still tiny, but I really don’t want to try to fix that now, so it’ll wait.

xmonad / xmobar / dmenu / trayer

My top bar with xmobar and the trayer were feeling a bit cramped, and so did my dmenu (the text-based launcher I use to start everything else). Some adjustments were required there:

  • I changed the configuration of the xmobar position in .xmobarrc to read position = Static { xpos = 1920, ypos = 0, width = 3456, height = 30 } ; the xpos parameter is set to 1920 because I don’t want that bar to be present on my secondary screen (and it’s setup to have a width of 1920); the width is 90% of 3840 so that I have 10% of the width for my trayer.
  • I wouldn’t have needed to touch my xmonad config if not for the fact that it’s launching dmenu, and that dmenu’s config is in the command line; I just modified the font of dmenu so that I have ((modMask, xK_p), spawn "dmenu_run -fn xft:terminus:style=medium:pixelsize=22") to start dmenu on Mod-P.
  • Finally, I only changed the height of the trayer (since the width is expressed as a percentage of the total width) so that it now reads trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --tint 0x191970 --height 30 --monitor 1 &. This part is in my “setup screen” script, so the modification here was minor.

gnome-terminal

I use gnome-terminal as my standard terminal: it’s the only thing I ever managed to configure exactly as I wanted it (set of colors, unicode handling, non-blinking cursor, and that sort of things.)

The font was on the small side on the highres display, so I switched to Terminus Regular size 22. I’m not convinced yet by that choice, because it feels bolder than I think it should be, so I may have to play with alternate choices at some point or another. For now, it’s good enough. And I don’t care about the UI scaling in general because I don’t use “anything else than writing on the terminal” often enough for it to be a problem.

Slack

I just zoomed to 150% in the default preferences in Accessibility. The menus and whatnot are still tiny, but I actually don’t care (because I don’t use them much). Good enough for now.

Darktable

Darktable the software I use to do most of my photo post-processing. The picture area is much nicer on the new screen (ahem. It may also have something to do with “the picture area is much nicer on a clean screen.), but the interface was also very tiny. Two things there:

  • in .config/darktable/darktablerc, set screen_dpi_overwrite=150 – I didn’t feel the need to experiment more with other values, this works for me
  • in the UI settings (available from the interface), set the “width of the side panels in pixels” to 400.

It is necessary to restart Darktable after this modification.

GIMP

Since I also started to learn how to use GIMP, it did cross my mind to set it up during my initial setup. Two things:

  • I defined the icon size to “Large” in Preferences > Interface > Icon Theme
  • I also defined the font name to “sans 16” in my theme file, /usr/share/gimp/2.0/themes/gtkrc (defined in Preferences > Interface > Theme).

And this can be reloaded without restarting Gimp 🙂

IntelliJ / CLion

I’m using IntelliJ at work, and the rest of the JetBrains IDEs at home. These days, I’m using CLion to develop on Marzipan (my fractal generator). IntelliJ scales its interface depending on the UI font size; so in Settings > Appearance & Behavior > Appearance, I modified the custom font for a size of 20.

This doesn’t modify the editor font size, though, which needs to be defined in Settings > Editor > Font.

Also, I know have a stronger incentive to continue working on my fractal generator: now that I have a higher res screen, I’m tempted to generate high res images, so I need to optimize that 😉 And also probably to decouple the size of the image from the size of my UI 😛

World of Warcraft

I’ll admit, WoW is one of the first things I tested after plugging in everything and checking that basic function was there. I’m running WoW on WINE – and this was actually the least painful experience: it started without problem, the UI scaled properly immediately, and everything was just as I left it. The only difference is that the cursor is smaller (and that I probably need to modify my mouse sensitivity). But all in all, flawless. And it still runs 100fps, which is cool. (I did feel the need to triple check that I was indeed running in that large resolution. It seems I am.)

Slay the Spire

Other game I play a lot, Slay the Spire – there, I had to adjust resolution manually, but once that was done, nothing to see here, move along.

Conclusion

This may seem like quite a lot of work, and some snark along the lines of “if you ran Windows/MacOS/GNOME/KDE you wouldn’t have to configure things in such a gazillion places” may be warranted – but to me the “having things exactly as I want them” is definitely worth a bit of extra work – as well as knowing that once the configuration is stable, it doesn’t break at every update 😉

I’ll probably find a couple more things to fix in the near future, and I’ll update this post with my findings.