Huh, I wasn't aware of wakapi. I recall seeing wakatime several(I think?) years ago and liking the idea but ruling it out because of the reliance on their backend.
I'm not sure this particular script is useful to me but it's made me aware of wakapi so thanks for that!