timewarrior
timewarrior copied to clipboard
Hint ':add' for command start
Analogous to
timew start FOO BAR BAZ
stop FOO
which only would stop tracking for FOO but will keep tracking running for BAR and BAZ, add a hint :add such that
timew start FOO
timew start :add BAR
would stop tracking for FOO and then create a new interval with tags FOO BAR.
Spawned from #151
My primary use case for this would be to track the time spent sitting and standing while working. Is this feature on your roadmap? If not then I might try to code it.
@maciejmotyka Do you want to track additionally whether you sat or stood while working? Otherwise
$ timew start STANDING
...
$ timew start SITTING
...
should already do the job. Please give a small sketch of your usecase before proceeding to code it. What command calls to you envision, how should the application behave?
I use taskwarrior integration to track tasks, I'd like to independently trigger non-task tracking like sitting/standing time or office/home location. Usually, my tasks have several tags, so having to look them up and retype would be a pain.
Example command calls for performing 2 tasks and independently tracking location and posture.
timew start OFFICE
timew start :add STANDING
taskwarrior start :add task1
taskwarrior done task1
taskwarrior start :add task2
timew stop STANDING
timew start :add SITTING
taskwarrior done task2
timew stop
For convenience I would use personal aliases
alias sit='timew stop STANDING; timew start :add SITTING'
alias stand='timew stop SITTING; timew start :add STANDING'
Currently this workflow will fail with the default on-modify hook. The hook will treat the :add from the third line as a tag and thus this will just start a new interval with tags :add task1.
Btw. there is PR #329 which would introduce the requirement that task and interval have the same tag set. This would also conflict with your workflow. 🤔
To answer your previous question: The :add hint for command start is currently not on the roadmap. You may give it a try, but I cannot promise when it will be included. Considering the above, there is a bit more to do to accomplish your desired workflow...
Thanks for all the info. I guess, for now, I'll figure out how to spawn a second independent instance of timewarrior that's not hooked to taskwarrior and track these additional tags there.
Yes, I would also suggest using a second db, maybe something like this:
timew() {
positiondb=/tmp/timew/positiondb
case "$1" in
stand) TIMEWARRIORDB=$positiondb command timew start STANDING "${@:2}";;
sit) TIMEWARRIORDB=$positiondb command timew start SITTING "${@:2}";;
stop) TIMEWARRIORDB=$positiondb command timew stop
command timew "$@";;
*) command timew "$@";;
esac
}

What about a different syntactic approach? Make continue work on still running intervals, and introduce +/- syntax for tags, e.g.
timew start foo bar
# Tracking bar foo
timew continue +baz -bar
# Stopping bar foo
# Tracking baz foo
I would like that quite alot
timew cont +baz -bar would collide with the feature continue by tag of the continue command.
But adding support for +<tag>/-<tag> to the start command might be an option to consider.
$ timew start foo
# tracking 'foo'
$ timew start bar
# tracking 'bar' (without prefix, usual switching behavior)
$ timew start +foo
# tracking 'foo' 'bar' (equivalent to `$ timew start foo bar`)
$ timew start -bar +baz
# tracking 'foo' 'baz' (equivalent to `$ timew stop bar ; timew start foo baz`)
This would enhance the present behavior of start, however require to disallow + and - as the first character for tags.
I am using + for some of my tags, for me it represents tags from the corresponding taskwarrior task. There is some related discussion already at issue 451