https://github.com/jeff-knurek/hours-worked
track if the linux user is actively logged in and no screensaver (ie, track how many hours worked)
https://github.com/jeff-knurek/hours-worked
go hours-worked time-tracker
Last synced: 2 months ago
JSON representation
track if the linux user is actively logged in and no screensaver (ie, track how many hours worked)
- Host: GitHub
- URL: https://github.com/jeff-knurek/hours-worked
- Owner: jeff-knurek
- License: mit
- Created: 2020-09-02T16:14:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-24T05:36:40.000Z (about 4 years ago)
- Last Synced: 2025-01-21T17:48:55.333Z (4 months ago)
- Topics: go, hours-worked, time-tracker
- Language: Go
- Homepage:
- Size: 112 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hours-worked
A little tool that tracks if the user is actively logged in and no screensaver. ie, track how many hours worked (or just tracks how much time spent in front of the screen).Developed specifically for ubuntu 18.04 _(soon to be tested on 20.01)_. Focused on the fact that multiple users might be running on the same machine without actually logging off, so it tracks the UI activity of the user.
Config values can be passed by cli args, and/or provided via `~/.hours-worked/config.toml`. If that files doesn't exist on first run, a default one will be created.
### Examples
#### Menu icon
#### CLI Text Report
## Install
In order to show the menu icon, `github.com/getlantern/systray` requires a few libraries: _(some may already be installed)_
```
sudo apt install gcc libgtk-3-dev libappindicator3-dev gir1.2-appindicator3
```The latest release can be downloaded directly from the [release page](https://github.com/jeff-knurek/hours-worked/releases)
### systemctl
While you can use any option to run this, if splitting across multiple users, `systemctl` might be a good approach.
Save the binary to `/usr/local/bin` and create a file: `~/.local/share/systemd/user/hours-worked.service` with:
```
[Unit]
Description=track hours worked[Service]
Type=simple
ExecStart=/usr/local/bin/hours-worked track
Restart=always
StandardOutput=journal[Install]
WantedBy=default.target
```And run:
```
systemctl --user enable hours-worked.service
```Logs can be found: `journalctl --user | grep hours-worked`
## Reporting Time
Results of time tracked are saved in json file `~/.hours-worked/tracked.json`,
A simple text report can be generated in cli running: `hours-worked report`. _(future reporting output formats are to be developed)_
## Contributing
It should be fairly easy to port this solution to also work with Mac, but would require someone else to test/implement.
While the tool is simple in what it does and what it's used for, opening issues and new functionality PRs are most welcome.
data format of time tracked:
```
{
: {
"2020": { //year
"January": { //month
"1": 0,
"2": 180, // day: minutes active
},
}
},
}
```