SL Phase II - KW Contributions
As part of the second phase of the SL course, we chose to contribute to the Kernel Workflow codebase again. In phase one, we had already made a contribution, as registerd in this post, renaming kw mailto kw send-patch.
For this phase, we aimed at a different feature: kw pomodoro.
The Pomodoro util
kw pomodoro is an util offered by kw that provides support to pomodoro sessions. It allows users to set and check timers, with or without tags, that trigger notifications when a timer finishes. If tagged, those sessions are registered in a local sqlite database that feed the kw report feature.
The following command sets a timer of two seconds, with the tag ‘new-feature’, and description ‘first steps’.
1
kw pomodoro --set-timer 2s --tag new-feature --description 'first steps'
If we execute kw report now, we get
1
2
3
4
5
## new-feature
- Total focus time: 00:00:02
- Number of sessions: 1
- Sessions:
(2024-06-26 17:28:39->17:28:41) [Duration 00:00:02]: first steps
And now:
1
kw pomodoro --set-timer 10s --tag new-feature --description 'second steps'
Updates the report to:
1
2
3
4
5
6
## new-feature
- Total focus time: 00:00:12
- Number of sessions: 2
- Sessions:
(2024-06-26 17:28:39->17:28:41) [Duration 00:00:02]: first steps
(2024-06-26 17:29:36->17:29:46) [Duration 00:00:10]: second steps
For more information, refer to the official kw docs.
Our contribution
Currently, to check the active timers, the user might execute kw pomodoro --check-timer, that only yields the current timer’s status and exits. We felt it could benefit from a “watch mode”, like many libs provide. So we opened an issue in the Kworkflow repo, which contains more details about our suggestion.
Beyond allowing users to constantly monitor their pomodoro sessions, we felt that a watch mode could pave the way for new features such as executing pomodoro actions on keyboard inputs. That’s why after developing the first “MVP” solution, and submitting its Pull Request, while we waited for review, we started working on a new version that allowed users to execute commands when on watch mode, and implemented the “stop” command.
The first pull request then had many changes requested by the project maintainers, and currently we are still working on them. The changes left are adding automated tests and updating the documentation, but we have already achieved the functionality we desired.