I use WakaTime to measure and improve my focus. Reading Deep Work by Cal Newport made me realize the importance of deep sustained focus. WakaTime seamlessly helps me achieve this goal, and I strongly recommend it.
If the above command doesn't work, download install_cli.py and run it manually with Python 3.
Or, find the wakatime-cli release asset corresponding to your platform, extract it to ~/.wakatime/ then create a symlink from ~/.wakatime/wakatime-cli to the platform specific build in that same folder.