Giter Site home page Giter Site logo

gkssjovi / trackwarrior Goto Github PK

View Code? Open in Web Editor NEW
23.0 1.0 1.0 3.85 MB

This extension create a link between taskwarrior and timewarrior that allows you to keep track of time spend on tasks. The time will be displayed in a new column in taskwarrior.

License: MIT License

Python 12.99% JavaScript 71.41% Dockerfile 3.03% Shell 5.89% Vim Script 4.24% Tcl 2.44%
timewarrior taskwarrior

trackwarrior's Introduction

Description

This extension create a link between taskwarrior and timewarrior that allows you to keep track of time spend on tasks. The time will be displayed in a new column in taskwarrior.

Docker

git clone https://github.com/gkssjovi/trackwarrior.git
cd trackwarrior

sudo ln -s "$PWD/bin/trackwarrior-docker" /usr/local/bin/trackwarrior

Use tasksh as main frontend

sudo rm /usr/local/bin/trackwarrior
sudo ln -s "$PWD/bin/trackwarrior-docker-tasksh" /usr/local/bin/trackwarrior

Use taskwarrior-tui as main frontend

sudo rm /usr/local/bin/trackwarrior
sudo ln -s "$PWD/bin/trackwarrior-docker-tui" /usr/local/bin/trackwarrior

Local Installation

git clone https://github.com/gkssjovi/trackwarrior.git
cd trackwarrior

cp -r ./taskwarrior/hooks/. ~/.task/hooks
cp -r ./timewarrior/extensions/. ~/.timewarrior/extensions

cd ~/.task/hooks
chmod +x on-modify.trackwarrior on-add.trackwarrior

cd ~/.timewarrior/extensions
chmod +x trackwarrior-duration.js trackwarrior-ids.js

Configuration

Copy those lines into your ~/.taskrc file

uda.trackwarrior.type=string
uda.trackwarrior.label=Total active time
uda.trackwarrior.values=

uda.trackwarrior_rate.type=string
uda.trackwarrior_rate.label=Rate
uda.trackwarrior_rate.values=

uda.trackwarrior_total_amount.type=string
uda.trackwarrior_total_amount.label=Total amount
uda.trackwarrior_total_amount.values=

# this allow only one task to be active
max_active_tasks=1 
# when you delete the task, the time tracking will be also be deleted from timewarrior 
erase_time_on_delete=false 
# those are tags in taskwarrior.When you add one of them the time tracking will be deleted from timewarrior
clear_time_tags=cleartime,ctime,deletetime,dtime
update_time_tags=update,updatetime,utime,recalc
create_time_when_add_task=false
rate_per_hour=10
rate_per_hour_decimals=2
rate_per_hour_project=Inbox:0,Other:10
rate_format_with_spaces=10
currency_format=de-DE,EUR

To display the new column on the next report modify the ~/.taskrc file

report.next.labels=ID,St,Active,Age,Time,Rate,Total,...,Description,Urg
report.next.columns=id,status.short,start.age,entry.age,trackwarrior,trackwarrior_rate,trackwarrior_total_amount,...,description,urgency

Usage

If you installed the docker version, just run trackwarrior to open the configured fronted (default: fish shell).

Integrate with starship

  1. Locally install taskwarrior
  2. Install starship
  3. Set the correct rights for your local taskwarrior to read the data from the container
# trackwarrior needs to be used at least once
sudo chown "$(id -u):$(id -g)" ~/.trackwarrior-docker/.task/pending.data
  1. Add the following to your starship.toml
[custom.current_task]
command = """TASKRC=~/.trackwarrior-docker/.taskrc TASKDATA=~/.trackwarrior-docker/.task unbuffer task starship-project | head -5 | tail -1 | sed "s/No matches./[No active task]/" | xargs"""
when = true
shell = "bash"

Usage Examples

If you use a tasksh as a frontend, you can use the same commands as shown here, but without typing task in the beginning.

If you use taskwarrior-tui as a frontend, check the taskwarrior-tui documentation instead.

Example

Create a new task

task add 'This is task 1' project:Example
task next

 ID St Age   Project Description    Urg
  1 P  10s   Example This is task 1    1

Start the new created task

task 1 start
task next

 ID St Active Age   Time    Project Description    Urg
  1 P    4s   18s   0:00:00 Example This is task 1    5

Stop the new created task

task 1 stop
task next
View the time tracking in taskwarrior

 ID St Age   Time    Project Description    Urg
  1 P  46s   0:00:15 Example This is task 1    1

View the time tracking in timewarrior

timew summary Example

Wk  Date       Day Tags                                   Start      End    Time   Total
W43 2021-10-31 Sun Example, This is task 1, |20d4fa9c| 22:49:41 22:49:49 0:00:08
                   Example, This is task 1, |20d4fa9c| 22:50:04 22:50:11 0:00:07 0:00:15

                                                                                 0:00:15

Delete the time tracking

task 1 mod +cleartime or task 1 mod +ctime or task 1 mod +deletetime or task 1 mod +dtime

Update time tracking

task 1 mod +update or task 1 mod +updatetime or task 1 mod +utime or task 1 mod +recalc

trackwarrior's People

Contributors

gkssjovi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

hardliner66

trackwarrior's Issues

Re-calculate time from timewarrior

Sometimes I forget to start or stop a task. When this happens, I have to correct the time in timewarrior and then manually edit the time in a task so it matches up again.

It would be cool to have a timewarrior extension which could re-export all tracked times to taskwarrior and do that recalculation.

Push to docker

It would be nice if you could create the docker user and repository so that others can pull from there.

There is a github workflow to automatically push to dockerhub when a tag is created. So once the account and repo on dockerhub are created, you just need to add DOCKER_USERNAME and DOCKER_PASSWORD to the repo secrets.

The workflow currently assumes username trackwarrior and repo name trackwarrior. If you want to change that to something like gkssjovi/trackwarrior we would need to replace all instances in the workflow, scripts and readme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.