https://github.com/romankornev/focus
Cross-platform tool that monitors time spent in different applications
https://github.com/romankornev/focus
analysis analytics cross-platform crossplatform ipython-notebook jupyter-notebook linux notebook plot plotting productivity python time-management time-series time-tracker timeseries timetracker visualization
Last synced: 7 months ago
JSON representation
Cross-platform tool that monitors time spent in different applications
- Host: GitHub
- URL: https://github.com/romankornev/focus
- Owner: RomanKornev
- License: mit
- Created: 2016-07-31T17:25:39.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-01-21T12:18:51.000Z (over 6 years ago)
- Last Synced: 2025-01-12T15:35:34.095Z (9 months ago)
- Topics: analysis, analytics, cross-platform, crossplatform, ipython-notebook, jupyter-notebook, linux, notebook, plot, plotting, productivity, python, time-management, time-series, time-tracker, timeseries, timetracker, visualization
- Language: Jupyter Notebook
- Homepage:
- Size: 695 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Focus
A tool I wrote for myself to help me keep track of how much time I spend using different programs or browsing web.Consists of 2 parts:
- Polling script for data gathering
- Jupyter Notebook for analysis### Polling script
The polling script continuosly records current window in focus and saves it to ```./logs/``` as ```.json.gz```It saves data such as pid, window name, process creation time, time in focus, executable path, command line arguments.
Every switch of a window is a new data point (to make a sequence plot described below).It also filters any idle time into a different data group and has keywords that won't set the idle timer.
If it lacks permissions or another error occurs, it will put window names with traceback in error log.
### Notebook
The notebook `Focus.ipynb` looks like this:
It categorizes every data point by ```window_name``` and ```exe``` using custom ```OrderedDict``` tables.
Different plots are available:
- ```plot_day_sequence_chart``` similar to [Gantt chart](https://en.wikipedia.org/wiki/Gantt_chart) but with top ```N``` categories (above picture).
- ```plot_top_categories``` plots top ```N``` categories of all time.
- ```plot_top_by_date``` same as above but splits each category by days.
- ```plot_category_by_day``` plots one category usage each day.
- ```plot_timeline_by_category_time``` same as above but for top ```N``` categories.## Installation
I recommend using [Anaconda](https://www.continuum.io/downloads)
### For the polling script
To install necessary components for the polling script:
```
conda install psutil ujson
```
#### Additiinal componentsIf on Windows:
```
conda install pywin32
```
If on Linux:
```
sudo apt-get install xprintidle xdotool
```
#### Autostart
##### Windows
To run the logging script on startup, put a shortcut of the script `focus_bg.pyw` into `C:\Users\USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\` .##### Linux:
```
crontab -e
@reboot python /path/to/focus_bg.pyw
```
### For the notebook
```
conda install pandas seaborn
```