Package: actlog
ActLogActLog is an activity log that shows you what you did when. It logs when you
were active on your desktop and takes periodic screenshots so you later can see
what you did.This helps with mental health (I did actually do something!) and with e.g.
filling out time sheets.It runs under Xorg. It does not (yet?) run under Windows, Mac or under Wayland.ScreenshotsFeaturesTrack active time using an "active detector". Use the defaults or roll your
own.Periodically store sceenshots so you can see what you did when.They can be pruned/expired so we don't use massive disk space.A web interface and CLI for seeing your activity.Open Source MIT license.User documentationQuick version: Installation and running from PyPI:First you'll need to install some prerequisites. We need these Debian/Ubuntu
packages:sudoaptinstallscrotimagemagickpngquantxprintidleEitherscrotorimagemagickare needed to create screenshots.imagemagickandpngquantare optional and reduce screenshot size.xprintidleis only
required if you're not running under a new GNOME.For other distros, you may need to modify the package names. (Weirdly, there is
noxprintidlepackage for Fedora, but it can becompiled
manually.)$python3-mvenv/path/to/my/virtual/environment
$/path/to/my/virtual/environment/bin/pipinstallactlog# This starts the monitor (that stores logs and creates screenshots)# and the web server.$/path/to/my/virtual/environment/bin/actlogdaemonNow wait 15-20 minutes while you're using your computer and then open your
browser athttp://localhost:1248to see some activity.Instead of using the web interface, you can also use the cli:$/path/to/my/virtual/environment/bin/actloglog--help# This will show you a log of your activity from last Thursday$/path/to/my/virtual/environment/bin/actloglog--from"last Thursday"$/path/to/my/virtual/environment/bin/actlogview--help# This will show screenshots from yesterday and today# in `eog`, GNOME's image viewer$/path/to/my/virtual/environment/bin/actlogview--viewereogStarting with systemdStop any runningactloginstance.Copyactlog.serviceto~/.config/systemd/user/actlog.serviceand modify
theExecStartpath to be/path/to/my/virtual/environment/bin/actlog daemon.systemctl --user daemon-reloadsystemctl --user enable actlogsystemctl --user start actlogAnd to check it is running:systemctl --user status actlogConfig fileActlog uses a config file:~/.actlog/config.yamlor you can specify one withactlog --config-file FILE. It lets you set all the same options as you see
with--help. E.g.:global:storage:/my/custom/actlog-storageview:viewer:eogwill set the global--storageoption and the--vieweroption for theviewsubcommand. Seeactlog --helpand help for the subcommands, e.g.actlog view --help.Future enhancementsTop Priority: Password protection of Web UI - Otherwise screenshots are
available to all onhttp://localhost:1250.scrypt password generation, checking, editingsessions and gunicornhttps://pypi.org/project/python-pam/Reducing the number of external/non-python dependencies, to make it easier to
install.dbus-python on fedora: sudo dnf install @development-tools dbus-devel cmake glib2-devel python3-develVisualize everything on atimeline - vis.js - A dynamic, browser based
visualization library.Also store title of active windowand title/url of current browser tab e.g. re-using ActivityWatch browser
plugin?Use screenshot metadata for more features?Support more desktop environments than Debian/Ubuntu GNOME.Wayland support: Tricky since there is no API for taking screenshots without
the desktop blinking, but itappearsto be possible in principle at least.Somehow pin python dependencies, (like would be done withpackage-lock.jsonwithnpm). As a start, the dependencies that we know work are stored inrequirements-that-work.txt, created withpip-compileinMakefile. But if
I manually downgrade a package,pip-compilestill shows the newest package,
not the one actually installed, so I don't really trust it.Related projectsSimilar ideasActivityWatch - Open-source time trackerGetting startedGitHub - selfspy/selfspy: Log everything you do on the computer, for statistics, future reference and all-around fun!GitHub - karpathy/ulogme: Automatically collect and visualize usage statistics in Ubuntu/OSX environments.Relies on the user to input activityKimai - Open Source time-trackerClosed sourceRescueTime: Fully Automated Time Tracking SoftwareTime Tracker Management Tracking SoftwareDeveloper documentationProject organization and how to run with a git checkoutThe project consists of a python "backend" and a JavaScript/svelte/nodejs
frontend with the web user interface (under./frontend/).The python backend contains the monitor and the web server. The monitor does the
actual logging and creating screenshots, and the webserver serves the svelte
frontend and provides APIs for it to get log and screenshot information.The python code by default runs under the assumption that there is avenvenvironment under./venv.makewill build such avenv, build both the python backend and the frontend
so they're ready to use../devwill set up some environment variables
that allow you to easily run from a non-installed directory. So:$make
$./devactlogdaemonAnd then open your browser athttp://localhost:1248. Allow for 15-20 minutes to
see some data. Again, you can$./devactloglog--from"last Thursday"$./devactlogview--viewereogRunning developer versions of monitor and webserver(s)By defaultactlog daemonruns the montior and a production webserver (undergunicorn). Using this setup, if you change any code
in either the frontend or backend, you need to stop the daemon, perhaps rebuild
the frontend and then restart the daemon.Thankfully there are better ways.Start the monitor separately from everything else with:$./devactlogdaemon--monitor-start-onlyNow start the python webserver in a development version with hot reloading so
code changes are visible immediately:$./devactlogdaemon--dev-web-server-start-onlyThis still serves a built version of the frontend. If you want to modify the
frontend as well, run the development frontend webserver with frontend hot
reloading:$cdfrontend
$npmrundevNow use the web user interface athttp://localhost:5173/(notice the different
port number).This only works with the dev web server (--dev-web-server-start-only), since
it also disablesCORS,
a requirement for thenpm run devweb server to access the backend API.(I usetmuxfor keeping these three running so I don't need three terminals,
but that is up to you.)Data: SQL and screenshots files$sqlite3~/.actlog/storage/actlog.db'.tables'activity_log

$sqlite3~/.actlog/storage/actlog.db'.schema activity_log'CREATETABLEactivity_log(timeREAL,activityTEXT,detailsTEXT);$catselect.sql
SELECTid,DATETIME(time,'unixepoch','localtime')ast,time,activity,details
FROMactivity_log
LIMIT2$sqlite3~/.actlog/storage/actlog.db<select.sql2023-10-0107:47:51|1696160871.11847|startup|{"pid":279556}2023-10-0107:47:51|1696160871.12261|active|$ls-1~/.actlog/storage/screenshots|head-n42023-10-05_10:00:19+0200.png2023-10-05_10:15:22+0200.png2023-10-05_10:30:24+0200.png2023-10-05_10:45:28+0200.pngExtension pointsscreenshot_metadata.pyHere is a sample~/.actlog/screenshot_metadata.pythat checks to see if there
is a window running with a secret title, and if so, creates screenshot metadata{"secret": true}.importsubprocessdefmetadata():result=subprocess.run("wmctrl -l | grep -q 'Secret Window Title'",shell=True);ifresult.returncode==0:return{"secret":True}else:return{}Activity detectionDetecting user activity an be done in multiple ways. Whether the screensaver is
active is one reliable signal, butxprintidleis another.By default, we first see if we can detect the screensaver status. This is
currently done for Gnome (tested on Gnome 43.6). But you can also add your own
activity detector. See help for the--active-detectoroption for the daemon
subcommand, and see an example inexamples/detect_active.py. Bug reports and PRs
for other (tested) detection mechanisms, or even just testing for other desktop
environments are welcome. Thisdiscussioncould be a starting point.So first we try to see if the user has a custom active detector, if not we try
to detect the GNOME screensaver, and fallback to usingxprintidleand declare
inactivity after--inactivity-timeminutes (default: 5) of inactivity.ReleasingBump version:vi pyproject.toml frontend/package.json frontend/package-lock.jsonCommit everythingmake packageUpload to testpypi:./venv/bin/python3 -m twine upload --repository testpypi dist/*Username:__token__Password: pypi-.* (for testpypi token)Test installrm -rf /tmp/venv-test && python3 -m venv /tmp/venv-test
/tmp/venv-test/bin/pip install -r $w/actlog/requirements-that-work.txt
/tmp/venv-test/bin/pip install --index-url https://test.pypi.org/simple/ --no-deps actloggit tag $versiongit push --tags origin mainUpload to pypi:./venv/bin/python3 -m twine upload dist/*Username:__token__Password: pypi-.* (for pypi token)Test installrm -rf /tmp/venv-test && python3 -m venv /tmp/venv-test
/tmp/venv-test/bin/pip install actlogTODOUse logger instead of print()Try running this on WindowsTry Wayland with hacked gnome-screenshot