Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bcdd847
add requirements.txt including notify to gnome
italogsfernandes Apr 3, 2020
c7f0dfb
add notification
italogsfernandes Apr 3, 2020
dd32711
include project filter
italogsfernandes Apr 3, 2020
10a11b8
include runing time entry
italogsfernandes Apr 3, 2020
3c2a45a
vscode settings
italogsfernandes Apr 3, 2020
957f0df
fix no running entry error
italogsfernandes Apr 3, 2020
5e00cb4
uses user relative path
italogsfernandes Apr 3, 2020
50ed13f
uses notify send option
italogsfernandes Apr 3, 2020
1e9d5d1
update readme
italogsfernandes Apr 3, 2020
fc46588
only notify when there is a running entry
italogsfernandes Apr 3, 2020
fca5082
add running flag
italogsfernandes Apr 3, 2020
2d2e211
add result image
italogsfernandes Apr 3, 2020
58b40d7
add argument untiltoday
italogsfernandes Apr 6, 2020
d4fd132
change print
italogsfernandes Apr 6, 2020
4ac96c9
udpate config template
italogsfernandes Apr 6, 2020
3d5cde4
last week and last month
italogsfernandes Apr 6, 2020
496bd7b
fix last month calc
italogsfernandes Apr 6, 2020
08770a0
add email text generation
italogsfernandes Apr 6, 2020
0a9f567
add eur to brl conversion
italogsfernandes Apr 6, 2020
d9b97ad
change conversion text
italogsfernandes Apr 6, 2020
536eb90
update cotation command
italogsfernandes Apr 6, 2020
887a0b7
fix persist
italogsfernandes Apr 6, 2020
3fabfa4
change output format (h and min)
italogsfernandes Apr 6, 2020
4ffd2ce
add min to notify menu
italogsfernandes Apr 6, 2020
074950e
new messages
italogsfernandes Apr 6, 2020
510b9ae
Change weekstart to sunday-
italogsfernandes Apr 6, 2020
dda5c7c
add lastweek report
italogsfernandes Apr 6, 2020
d3a76eb
fix minute conversion
italogsfernandes Apr 7, 2020
decb8af
update today
italogsfernandes Apr 7, 2020
3be4e18
change layout
italogsfernandes Apr 7, 2020
88f0940
fix layout
italogsfernandes Apr 7, 2020
886bd50
fix typo
italogsfernandes Apr 7, 2020
fb40aad
change text
italogsfernandes Apr 7, 2020
8888048
fix calc
italogsfernandes Apr 7, 2020
868bd5f
change min text to m
italogsfernandes Apr 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "venv/bin/python3.6"
}
50 changes: 45 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,61 @@
# togglore

Tool for the timetracker [toggle](http://toggl.com/) to calculate the difference between tracked time and the time you should have worked in a given range.

![result](docs/result.jpg)

## Setup

Create a config file and save it at ~/.togglore.
Create a virtual env using python3 and install the requirements.

```sh
virtualenv --python=python3 venv
source venv/bin/activate
pip install -r requirements.txt
```

Create a config file and save it at `~/.togglore`.

```sh
[Authentication]
API_KEY = 5b9f5e3fd7745a022781daf205f62c72

[Work Hours]
hours_per_day = 8.4
excluded_days = 2016.01.01
excluded_days = 2020.01.01,2020.01.30

[User Info]
id = 1
workspace = 1
id = 123123123
workspace = 123123123
project = 123123123
```

Where to find your information:

* **API_KEY**: You can find in the section "API Token" in your [profile page](https://toggl.com/app/profile).


* **id**, **workspace** and **project**: Open your reports summary in the toggl web app ([link](https://toggl.com/app/reports/summary/)). Then select a filter by Team (select your user) and by project (select the project you want to follow) as showed in the images. Copy the ids showed in the path: `https://toggl.com/app/reports/summary/<workspace_id>/period/thisWeek/projects/<project_id>/users/<user_id>`

![toggl](docs/image0.png)

![toggl](docs/image1.png)

## Running notifications

Open your crontab file (`crontab -e` in a terminal).
Then add the following line in your crontab file:

```bash
*/10 * * * * eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)" && ~/Documents/GitHub/togglore/venv/bin/python ~/Documents/GitHub/togglore/run.py --notify today
```

This will run the script with the notify option for today. The first part of the command is used to allow the use of notifications in gnome env when a script is called by crontab.

Obs: You should add to the crontab of your user, if you insists and add this to the sudo crontab you have to fix the HOME path.

## Run

```sh
# show diff for today
python3 run.py today
Expand All @@ -37,8 +75,10 @@ python3 run.py month 08
# show diff from 2016.08.01 until today
python3 run.py since 2016.08.01
```

The output is something like:
```

```text
Hours to do: 176.00h (22.00 days)
Hours worked: 186.65h (23.33 days)
Difference: 10.65h (1.33 days)
Expand Down
7 changes: 4 additions & 3 deletions config_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ API_KEY = 5b9f5e3fd7745a022781daf205f62c72

[Work Hours]
hours_per_day = 8.4
excluded_days = 2016.1.1,2016.12.30
excluded_days = 2020.01.01,2020.01.30

[User Info]
id = 1
workspace = 1
id = 123123123
workspace = 123123123
project = 123123123
Binary file added docs/image0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/result.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
get==2019.4.13
post==2019.4.13
public==2019.4.13
query-string==2019.4.13
request==2019.4.13
ruamel.yaml==0.16.10
ruamel.yaml.clib==0.2.0
vext==0.7.3
vext.gi==0.7.0
Loading