GithubHelp home page GithubHelp logo

alena-bartosh / speaking-eye Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 854 KB

:postal_horn::eyes: Track & analyze your computer activity. Focus on work and don't forget to take breaks

License: MIT License

Python 87.89% Shell 1.59% Makefile 1.96% CSS 8.56%
python3 gtk wnck worktracker dash pandas timetracker

speaking-eye's Introduction

Speaking Eye

codecov

πŸ‘€ Looking at

  • your working hours/breaks
  • activity in any apps (IDE, browser tabs, terminal, etc.)
  • distracting activity (custom list of apps/time limits)

πŸ“― Speaking about

  • your activity on the computer
  • overtime
  • time to take a break
  • distracting apps if you spend a lot of time there

🌐 Speaks in

  • english
  • ΠΏΠΎ-русски
  • ΡƒΠΊΡ€Π°Ρ—Π½ΡΡŒΠΊΠΎΡŽ

For other languages please feel free to make Pull Request πŸ˜‰

Report examples

Using Speaking Eye you can simply track you working hours:

  • during one day
  • or as many days as you like

Installation

Quick installation guide (video)

The simplest way of installation is

pip install speaking-eye

Also you will need some system dependencies.

sudo apt-get install \
    python3-dev \
    python3-venv \
    libcairo2-dev \
    libgirepository1.0-dev \
    python3-gi \
    gir1.2-gtk-3.0 \
    gir1.2-wnck-3.0 \
    gir1.2-appindicator3-0.1 \
    gir1.2-notify-0.7

Please relogin to ensure $PATH env var contains ~/.local/bin.

Now you can run Speaking Eye with command line or using Applications Menu in your desktop environment.

$ speaking-eye

To install application for developing please see steps on wiki pages.

Auto start

Auto start is enabled by default. After first run Speaking Eye will copy its .desktop file into ~/.local/config/autostart (or path from $XDG_CONFIG_HOME if set). Next time when you login application must start automatically.

To disable auto start please set it in config and rerun application. Speaking Eye will remove its file from autostart dir.

autostart: true  # change to false to disable

Use

Basics

After successful installation and start, you will see a tray icon. A running Speaking Eye (SE) has two states:

  • active (open; for working time);
  • disabled (crossed out; for free time).

Use the active SE to track your work. For this check the box 'Work Time' in the context menu. Eye is open: it thinks you are working. It will tell you about breaks, overtime and distracting activities. Use the computer as usual and show what you are capable of!

Break in SE terminology β€” is a locked screen. So when you get tired, just lock the screen for a while. After finishing work at the end of the day, change the status to disabled. Eye is crossed out: it thinks you are not working. It will not talk to you, but will continue to collect information about your activity.

You also can close SE with 'Close' in the context menu. Eye is closed: your browser activity is still tracked by ISP and Google. πŸ™ƒ

Config

For a comfortable interaction with SE, please fill in the config. You can open it with 'Edit Config' in the context menu.

Here you can choose the color theme of the icon and set time limits for notifications. Also choose which activity you want to track (it is necessary) and which apps are considered harmful or distracting (optional).

'work_time_hours' β€” is recommended to count with lunch. If work_time = 8 hours and lunch = 1 hour then it's better to set work_time_hours: 9.

To track a specific group of applications, follow this pattern:

- Reading about my favorite project:        # save selected windows activity under this title
    wm_name: Chromium|Firefox|Opera         # x11 window manager names
    tab: speaking-eye                       # look only at a specific tab in the window

# E.g. let's open 3 links in 3 different browsers: 

# Chromium: https://github.com/alena-bartosh/speaking-eye/actions
# Firefox:  https://speaking-eye.ua/whats-new
# Opera:    https://www.google.com/search?q=speaking-eye

# In this case SE will save all these activities as 'Reading about my favorite project'

Config will be saved into ~/.local/share/speaking-eye/config (or path from $XDG_DATA_HOME if set). Additional config example.

Data

SE saves all collected data to ~/.local/share/speaking-eye/data (or path from $XDG_DATA_HOME if set) into {date}_speaking_eye_raw_data.tsv files that contain such columns for each activity:

start_time, end_time, activity_time, wm_class, window_name, is_work_time

You can open needed directory with 'Open Data' in the context menu.

Reports

Reports are generated dynamically based on files with collected SE data and actual application groups in config. For reports displaying Dash server is used. You can configure it in application config and open report page by clicking on 'Open Report' in the context menu.

report_server:
  host: localhost
  port: 3838
  browser: firefox

SE analyzes only work time (when eye is active and open)!

Quick installation guide

speaking-eye installation

Demo

speaking-eye demo

🐌 Possible improvements

  • Now SE uses xprop (a program that can list and set x11 window properties). In the future we may want to use other window managers. Is it possible to get an active window using dbus?
  • Autogenerate config through GUI

Code conduction

Special thanks

  • @s373r for mentoring and your love for me and strong typing

speaking-eye's People

Contributors

alena-bartosh avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

speaking-eye's Issues

Problem with starting Alpha version

Just updated speaking-eye from Alpha into Beta and found some issues when starting the app 😲

πŸ“œ Problem:

$ bash start.sh

Traceback (most recent call last):
File "/home/tas/Workspace/speaking-eye/src/speaking_eye.py", line 67, in
main()
File "/home/tas/Workspace/speaking-eye/src/speaking_eye.py", line 61, in main
app = SpeakingEyeApp(APP_ID, config, logger)
File "/home/tas/Workspace/speaking-eye/src/speaking_eye_app.py", line 84, in init
self.__dbus_subscribe_to_screen_saver_signals()
File "/home/tas/Workspace/speaking-eye/src/speaking_eye_app.py", line 153, in __dbus_subscribe_to_screen_saver_signals
raise Exception('self.screen_saver_bus_names should be set!')
Exception: self.screen_saver_bus_names should be set!

✏️ Solution:

In order for app to work I removed next section from speaking_eye_app.py

if not self.screen_saver_bus_names:
    raise Exception('self.screen_saver_bus_names should be set!')

In my case self.screen_saver_bus_names was empty list. It seems that using not operator is not always the best choice 😏

πŸ“Œ Environment:

App was installed and started according to README. Python version is 3.7.3 ☝️

..
..
..

Problem with installing pycairo dependencies from requirements.txt [2]

Wanted to track my work activity with speaking-eye and found some issues while installing it.

Problem:

After removed pkg-resources (#1) from requirements.txt I got next error while building pycairo dependencies

$ git clone https://github.com/alena-bartosh/speaking-eye.git && \
    cd speaking-eye && \
    python3 -m venv .env && \
    source .env/bin/activate && \
    pip install --upgrade pip && \
    pip install -r requirements.txt

...
ERROR: Command errored out with exit status 1: /home/tas/Workspace/speaking-eye/.env/bin/python3 /home/tas/Workspace/speaking-eye/.env/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-qk6wrbri/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.

Solution:

In order to resolve this issue I installed missing system dependency with sudo apt-get install libcairo2-dev

Environment:

$ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=19.1
DISTRIB_CODENAME=tessa
DISTRIB_DESCRIPTION="Linux Mint 19.1 Tessa"
$ python3
>>> import sys; print(sys.version)
3.7.3 (default, Mar 27 2019, 22:11:17) 
[GCC 7.3.0]

Test speaking-eye==0.1.1 installation

Since Speaking Eye was added to PyPi it is necessary to test its installation steps. And make sure that the specified dependencies are enough.

For it I can install a fresh Linux system using GNOME Boxes and running commands from Installation section in README:

$ sudo apt-get install \
    python3-dev \
    python3-venv \
    libcairo2-dev \
    libgirepository1.0-dev \
    python3-gi \
    gir1.2-gtk-3.0 \
    gir1.2-wnck-3.0 \
    gir1.2-appindicator3-0.1 \
    gir1.2-notify-0.7

$ pip install speaking-eye
$ speaking-eye

Problem with installing pkg-resources from requirements.txt [1]

Wanted to track my work activity with speaking-eye and found some issues while installing it.

Problem:

Installed system dependencies but got error from setup command.

$ git clone https://github.com/alena-bartosh/speaking-eye.git && \
    cd speaking-eye && \
    python3 -m venv .env && \
    source .env/bin/activate && \
    pip install --upgrade pip && \
    pip install -r requirements.txt

...
ERROR: Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r requirements.txt (line 3)) (from versions: none)
ERROR: No matching distribution found for pkg-resources==0.0.0 (from -r requirements.txt (line 3))

Solution:

In order to resolve this issue I removed pkg-resources==0.0.0 from requirements.txt

Environment:

$ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=19.1
DISTRIB_CODENAME=tessa
DISTRIB_DESCRIPTION="Linux Mint 19.1 Tessa"
$ python3
>>> import sys; print(sys.version)
3.7.3 (default, Mar 27 2019, 22:11:17) 
[GCC 7.3.0]

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.