Coder Social home page Coder Social logo

aw-watcher-vim's Introduction

Records what you do so that you can know how you've spent your time.
All in a secure way where you control the data.


WebsiteForumDocumentationReleases
Contributor statsCI overview



Do you want to receive email updates on major announcements?
Signup for the newsletter!

Table of Contents

About

The goal of ActivityWatch is simple: Enable the collection of as much valuable lifedata as possible without compromising user privacy.

We've worked towards this goal by creating an application for safe storage of the data on the user's local machine and as well as a set of watchers which record data such as:

  • Currently active application and the title of its window
  • Currently active browser tab and its title and URL
  • Keyboard and mouse activity, to detect if you are AFK ("away from keyboard") or not

It is up to you as user to collect as much as you want, or as little as you want (and we hope some of you will help write watchers so we can collect more).

Screenshots

You can find more (and newer) screenshots on the website.

Installation & Usage

Downloads are available on the releases page.

For instructions on how to get started, please see the guide in the documentation.

Interested in building from source? There's a guide for that too.

Is this yet another time tracker?

Yes, but we found that most time trackers lack one or more important features.

Common dealbreakers:

  • Not open source
  • The user does not own the data (common with non-open source options)
  • Lack of synchronization (and when available: it's centralized and the sync server knows everything)
  • Difficult to setup/use (most open source options tend to target programmers)
  • Low data resolution (low level of detail, does not store raw data, long intervals between entries)
  • Hard or impossible to extend (collecting more data is not as simple as it could be)

To sum it up:

  • Closed source solutions suffer from privacy issues and limited features.
  • Open source solutions aren't developed with end-users in mind and are usually not written to be easily extended (they lack a proper API). They also lack synchronization.

We have a plan to address all of these and we're well on our way. See the table below for our progress.

Feature comparison

Basics
User owns data GUI Sync Open Source
ActivityWatch WIP, decentralized
Selfspy
ulogme
RescueTime Centralized
WakaTime Centralized Clients
Platforms
Windows macOS Linux Android iOS
ActivityWatch
Selfspy
ulogme
RescueTime Limited functionality
Tracking
App & Window Title AFK Browser Extensions Editor Plugins Extensible
ActivityWatch
Selfspy
ulogme
RescueTime
WakaTime Only for text editors

For a complete list of the things ActivityWatch can track, see the page on watchers in the documentation.

About this repository

This repo is a bundle of the core components and official modules of ActivityWatch (managed with git submodule). Its primary use is as a meta-package providing all the components in one repo; enabling easier packaging and installation. It is also where releases of the full suite are published (see releases).

Server

aw-server is the official implementation of the core service which the other ActivityWatch services interact with. It provides a REST API to a datastore and query engine. It also serves the web interface developed in the aw-webui project (which provides the frontend part of the webapp).

The REST API includes:

  • Access to a datastore suitable for timeseries/timeperiod-data
  • A query engine and language for such data

The webapp includes:

  • Data visualization & browser
  • Query explorer
  • Export functionality

Watchers

ActivityWatch comes pre-installed with two watchers:

  • aw-watcher-afk tracks the user active/inactive state from keyboard and mouse input
  • aw-watcher-window tracks the currently active application and its window title.

There are lots of other watchers for ActivityWatch which can track more types of activity. Like aw-watcher-web which tracks time spent on websites, multiple editor watchers which track spent time coding, and many more! A full list of watchers can be found in the documentation.

Libraries

  • aw-core - core library, provides no runnable modules
  • aw-client - client library, useful when writing watchers

Folder structure

Contributing

Want to help? Great! Check out the CONTRIBUTING.md file!

Questions and support

Have a question, suggestion, problem, or just want to say hi? Post on the forum!

aw-watcher-vim's People

Contributors

ahnlabb avatar drrdietrich avatar erikbjare avatar filipharald avatar hanaasagi avatar johan-bjareholt avatar k-cybulski avatar lumbric avatar lunarwatcher avatar luxed avatar nick22985 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aw-watcher-vim's Issues

Occasional error when exiting: `Error detected while processing function HTTPPostOnExitNeovim...`

Hi,

I occasionally get the following error after exiting vim:

Error detected while processing function HTTPPostOnExitNeovim:
line    2:
E716: Key not present in Dictionary: 7
E116: Invalid arguments for function str2nr
E15: Invalid expression: str2nr(s:http_response_code[l:jobid_str][0])
line    3:
E121: Undefined variable: l:status_code

I'm using nvim v0.4.4:

❯ nvim --version
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.4/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Data still seems to be collected but it's a bit annoying. Did you come across this?

We are not inclusive enough in the heartbeats

Currently we only send heartbeats when we move the cursor, when we enter a buffer and when we start vim. The heartbeats are only on intervals of 10s. This has the flaw of for example if we are writing a command for a while such as a complex search/replace time will not be counted for that period as it takes more than 10s.

From looking at my own logs I can clearly see that at the editor activity is way too low, adding all my window titles with something VIM related is almost half of what my editor activity is so the activity time is currently not accurate at all while the window activity in my experience is very accurate.

We should start with increasing the pulsetime on the heartbeats as well as investigate if there are more autocmd we can call heartbeats on to make things more accurate.

I started reflecting on this after reading ActivityWatch/aw-watcher-vscode#10

That watcher is still valid?

Few days ago I adopted AW in my system and follow the instructions to get aw-watcher-vim and manage the integration with AW but the last unfortunately not worked.
I use AstroNvim (a renown neovim's config distribution) and manually cloned aw-watcher-vim into ~/.config/nvim/bundle as you recommend. Start nvim(is an appimage) and nothing happens(I also tried to get the files out of aw-watcher-vim dir but without luck).
Also :AWStart and :AWStatus in nvim's cmd line are not recognizable cmds

what have to do for enable aw-watcher-vim in order to work seamlessly with AW?

PS: I'm not sure what that watcher do but actually AW records Terminal's events and AstroNvim's tab (cause the Terminal window title). I saw the other 3 issues aw-watcher-vim had tracking accuracy problems, actually what's the state of those issues?
TIA

send filetype name

We should add so the watcher sends the filetype aswell

The language can be fetched in vim with :set filetype?

Add branch information

It would be awesome if we could add the git branch we're working on into the heartbeat. I find it useful as it can give hints of what task you're working on inside a project.

Thanks for maintaining the watcher :)

Not working in vim 8

I have Vim 8 with python3 enabled in Ubuntu 18.04, and my plugin manager is Plug . I cloned the directory into ~/.vim/plugged but it is not working . Can somebody suggest what went wrong ?

Git branch slow on windows - nvim

Hi,

I've noticed that the systemlist() call in line 110 of 6d2138e drastically slowed down my nvim; pretty much slow motion.

bug.mp4

It's more an issue of neovim/windows than with this repo, so feel free to close.
The plugins works just fine on Arch :)

If anyone has a quick fix/idea other than disabling the branch function, I'd appreciate it.

Issue with neovim+alacritty

Hi there! Thanks for the plugin :D

Is there any known issue with alacritty and/or using neovim instead of vim?

It seems to be tracking more or less accurately but with constant intervals (even though I'm not actually doing anything else but using nvim). It seems to track the activity sort of on and off.
I do use a stupid amount of tabs and splits (no tmux, just nvim), so maybe that has something to do with it?

I hope I'm not missing anything here.

nvim incompatible

Looked into it and tried to fix, didn't have time to finish for now though so leaving this issue here for now

Unable to install aw-client due to failing aw-core requirement

Hello :)

Trying to get this to work on my PC with the latest version (b8ad0e7), but am experiencing some problems.
Installing aw-core works fine, but when installing aw-client I get the following error message:

Could not find a version that satisfies the requirement aw_core (from aw-client==0.3) (from versions: )

I get this error both when running the following, as per the readme:

pip3 install git+https://github.com/ActivityWatch/aw-core.git
pip3 install git+https://github.com/ActivityWatch/aw-client.git

and when installing from my local source with:

cd ~/programs/activitywatch/aw-core && pip3 install --user --editable ./
cd ~/programs/activitywatch/aw-client && pip3 install --user --editable ./

Running pip3 list shows aw-core as installed:

aw-core (0.4.1, /home/johan/programs/activitywatch/aw-core)

Running import aw_core in a Python 3.6.5 console works fine.

I'll try to find out why this occurs, but any help would be appreciated!

Cumbersome to use within virtual environments

When running vim within a virtual environment (that does not have aw-client installed) things go crazy.

Also, sometimes you might use a non-system version of Python that use a different default pickle protocol (I got a warning when I installed aw-client in the virtualenv) which may have weird side effects.

Can't start watcher, weird channel errors? Data is 000

I finally decided to activitywatch after only knowing about this project for 4 years.

I installed this plugin and needed to copy some of the configuration to my vimrc. Spoiler alert: I did this: let g:aw_apiurl_host = 127.0.0.1.

Fast forward two hours of me learning lots about the rest API of aw-server, jobs and vim channels, trying to debug why curl -s http://127001/api/0/buckets/<hostname>/ wasn't working only to realise if you actually put let g:aw_apiurl_host = 127.0.0.1 into your vimrc then you're gonna have a BAD time. 127.0.0.1 actually concatenates that into 127001 and doesn't throw an error like how I would it expect it to do. So that's a learning.

My own debug logs of this, the "channel data" is somehow 000?
logs

Not sure what can be done with this, I tried to add some validation:

function! AWStart()
    " :h types here
    if type(s:apiurl_host) != 1
        echoerr "g:apiurl_host must be a string!"
        return
    endif
    if type(s:apiurl_port) != 0
        echoerr "g:apiurl_host must be a number!"
        return
    endif
    call s:CreateBucket()
endfunc

But since it's a string it passed my ad-hoc validation.

Naturally, I can blame the documentation: he said sarcastically, please don't hurt me

readme
Not sure what to make of this issue, but it hopefully makes someone that is having the same issue that might be searching github issues to find me in 2021 writing a post mortem 3 minutes to 1 am at a rainy wednesday night/morning.

Feel free to do whatever to this issue.

Log messages after startup of VIM

nvim shows after startup:

['INFO:persistqueue.common:Selected pickle protocol: ''4''', '2018-11-17 00:38:09 [INFO ]: Selected pickle protocol: ''4''  (persistqu
eue.common:14)', '']                                                                                                                  
Press ENTER or type command to continue    

vim shows the same message, but only the beginning and no "Pess ENTER...".

This is not a really problem, but I guess this shouldn't be displayed. Is this only my setup?

vimwatcher.py crashes when launching nvim: heartbeat() got an unexpected keyword argument

Problem

When launching nvim, vimwatcher.py crashes with the following error message:

['Traceback (most recent call last):', '  File "/home/johan/.config/nvim/plugged/aw-watcher-vim/plugin/vimwatcher
.py", line 57, in <module>', '    main()', '  File "/home/johan/.config/nvim/plugged/aw-watcher-vim/plugin/vimwat
cher.py", line 53, in main', '    aw.heartbeat(bucketname, event, pulsetime=pulsetime, queued=True, commit_interv
al=3)', 'TypeError: heartbeat() got an unexpected keyword argument ''commit_interval''', '']
Press ENTER or type command to continue 

Pressing Enter then gives:

['Traceback (most recent call last):', '  File "/home/johan/.config/nvim/plugged/aw-watcher-vim/plugin/vimwatcher
.py", line 57, in <module>', '    main()', '  File "/home/johan/.config/nvim/plugged/aw-watcher-vim/plugin/vimwat
cher.py", line 53, in main', '    aw.heartbeat(bucketname, event, pulsetime=pulsetime, queued=True, commit_interv
['']
Press ENTER or type command to continue

Pressing Enter again gives the same error as above, and finally pressing Enter a third time makes the error disappear.

After this, when pressing any key or click, the following error is thrown:

Error detected while processing function <SNR>20_Poke[1]..<SNR>20_Send:
line    4:
E900: Invalid channel id
Press ENTER or type command to continue

Environment

I've installed aw-watcher-vim with vim-plug by adding Plug 'ActivityWatch/aw-watcher-vim' in my vimrc and then running :PlugInstall.

I have the latest commit b8ad0e7 installed, with the following aw-packages in pip:

[I] ➜  ~ pip3 list | grep aw
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
aw-client (0.3.1, /home/johan/programs/activitywatch/aw-client)
aw-core (0.4.1)
[I] ➜  ~ 

aw-programs that are running when the crash occurs:

[I] ➜  ~ ps -A | grep aw
 2225 ?        00:00:37 aw-server
18975 ?        00:00:04 aw-qt
19058 ?        00:00:17 aw-watcher-wind
19059 ?        00:00:39 aw-watcher-afk
[I] ➜  ~ 

aw-watcher-vim successfully creates a bucket that is visible in the web UI, but it contains no data.

Broken in nvim

nvim seems to batch together send requests rather than sending them directly, so when aw-watcher-vim tries to heartbeat together the events they end up being very short because their timestamp are pretty much the same.
This results in that the durations are way too low, for example today I've been coding in vim for 3hrs while it only shows 50min.

Have looked at this for a while but not found the cause or how to circumvent it.

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.