Activity and idle watchers

Overview

Awatcher

Build Status Dependency Status

Awatcher is a window activity and idle watcher with an optional tray and UI for statistics. The goal is to compensate the fragmentation of desktop environments on Linux by supporting all reportable environments, to add more flexibility to reports with filters, and to have better UX with the distribution by a single executable.

The foundation is ActivityWatch, which includes the provided server and web UI. The unbundled watcher is supposed to replace the original idle and active window watchers from the original distribution. The bundled executable can be used independently as it contains the server, UI and tray.

The crate also provides a library with watchers which can send the data to the server.

Build

Prerequisites

Names of packages are from Ubuntu, other distributions may have different names.

  • Rust stable or nightly (for the bundle) toolchain
  • pkg-config
  • libssl-dev
  • libdbus-1-dev (for the bundled version)
  • build-essential

Compile

  • cargo build --release in the root of the repository.
  • The target file will be located at target/release/awatcher.

Add --no-default-features to the build command if you want to opt out of the Gnome and KDE support, add --features=? ("gnome" or "kwin_window") on top of that if you want to enable just one.

To track your activities in browsers install the plugin for your browser from here (Firefox, Chrome etc).

Compile with bundle

The executable can be bundled with a tray icon, ActivityWatch server and, optionally, Web UI (if steps 1-2 are done):

  1. Clone and follow the instruction in ActivityWatch/aw-webui@839366e to build the "dist" folder,
  2. Then zip it with zip -r dist.zip ./dist.
  3. Put the zip file to src/bundle.
  4. Build the executable with --features=bundle.

This should be compiled on nightly. The complete bundled version is also built and released.

Gnome needs the extension to support StatusNotifierItem specification.

The tray can be disabled with --no-tray option in the bundled version.

Supported environments

ActivityWatch server should be run before awatcher is running. At this moment only Linux is supported. The watcher type is selected automatically by availability of necessary interfaces in the given environment.

Environment Active window Idle
X11 🟒 🟒
Wayland + Sway 🟒 1 🟒 2
Wayland + KDE 🟑 3 🟒
Wayland + Gnome 🟑 4 🟒

Configuration

The config file is in the default directory (~/.config/awatcher).

[server]
port = 5600
host = "localhost"

[awatcher]
idle-timeout-seconds=180
poll-time-idle-seconds=4
poll-time-window-seconds=1

[[awatcher.filters]]
# match only "navigator"
match-app-id = "navigator"
# match any title which contains "Secret" or "secret" 
match-title = ".*[sS]ecret.*"
replace-app-id = "firefox"
replace-title = "Unknown"
  • server.port and server.host address the ActivityWatch server instance.
  • awatcher.idle-timeout-seconds is the time of inactivity when it is considered "idle".
  • awatcher.poll-time-idle-seconds and awatcher.poll-time-window-seconds are intervals between collecting and sending statistics.

All options of server and awatcher config file's sections can be overridden with command-line arguments, as well as the config path. See the builtin help in the command for details.

Filters

awatcher.filters in the config file is an array of filters and replacements for the cases when the application name or title should be hidden, or the app is reported incorrectly. Copy the section as many times as needed for every given filter.

  • match-app-id matches the application name.
  • match-title matches the title name.
  • replace-app-id replaces the application name with the provided value.
  • replace-title replaces the window title with the provided value.

The first matching filter stops the replacement. There should be at least 1 match field, and at least 1 replace field for a valid filter. Matches are case sensitive regular expressions between implici ^ and $:

  • . matches 1 any character
  • .* matches any number of any characters
  • .+ matches 1 or more any characters.
  • word is an exact match.
  • Use escapes \ to match special characters, e.g. org\.kde\.Dolpin

Captures

The replacements in filters also support regexp captures. A capture takes a string in parentheses from the match and replaces $N in the replacement. Example to remove the changed file indicator in Visual Studio Code:

  • Before: "● file_config.rs - awatcher - Visual Studio Code"
  • After: "file_config.rs - awatcher - Visual Studio Code"
[[awatcher.filters]]
match-app-id = "code"
match-title = "● (.*)"
# Inserts the content within 1st parentheses, this can be in any form, e.g. "App $1 - $2/$3"
replace-title = "$1"

Debugging app-id and title

Run the command with "debug" or "trace" verbosity and without reporting to server in the terminal to see what application names and titles are reported to the server.

$ awatcher -vvv --no-server

Footnotes

  1. A few other DEs besides Sway may implement wlr foreign toplevel protocol, ↩

  2. It implements KWin idle protocol. ↩

  3. KWin doesn't implement any toplevel protocol yet, KWin script is utilized instead (builtin, no actions required). KDE partially supports XWayland, but inconsistently, hence X11 is not utilized for it. ↩

  4. Gnome doesn't implement any toplevel protocol yet, so this extension should be installed. ↩

You might also like...
Leetcode Solutions in Rust, Advent of Code Solutions in Rust and more

RUST GYM Rust Solutions Leetcode Solutions in Rust AdventOfCode Solutions in Rust This project demostrates how to create Data Structures and to implem

:crab: Small exercises to get you used to reading and writing Rust code!
:crab: Small exercises to get you used to reading and writing Rust code!

rustlings πŸ¦€ ❀️ Greetings and welcome to rustlings. This project contains small exercises to get you used to reading and writing Rust code. This inclu

A catalogue of Rust design patterns, anti-patterns and idioms

Rust Design Patterns An open source book about design patterns and idioms in the Rust programming language that you can read here. Contributing You ar

Simple and performant hot-reloading for Rust

reloady Simple, performant hot-reloading for Rust. Requires Rust nightly and only works on Linux for now. installing CLI To install the CLI helper car

Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.
Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.

Speedy2D Hardware-accelerated drawing of shapes, images, and text, with an easy to use API. Speedy2D aims to be: The simplest Rust API for creating a

Compare the size of v8 and quickjs
Compare the size of v8 and quickjs

rust_v8_and_quickjs Size debug release quickjs 1,758,728 1,281,104 v8 40,047,648 20,956,816 Chart License rust_v8_and_quickjs is released under the MI

Rust, cargo and QEMU setup for multi-architecture OS development.

rust-osdev-jumpstart Rust, cargo and QEMU setup for multi-architecture OS development. Goal This repo should give you a boost in starting a bare-metal

Orion lang is a lispy programming language that is strongly and statically typed.
Orion lang is a lispy programming language that is strongly and statically typed.

Orion Orion is a lisp inspired statically typed programming language written in Rust Install To install orion you can either: Download binary from the

Visualization for Timely Dataflow and Differential Dataflow programs
Visualization for Timely Dataflow and Differential Dataflow programs

DDShow Visualization for Timely Dataflow and Differential Dataflow programs Getting started with ddshow First, install ddshow via cargo. As of now dds

Releases(v0.0.3)
Owner
null
An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous and blocking clients respectively.

eithers_rust An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous a

null 2 Oct 24, 2021
Safe, efficient, and ergonomic bindings to Wolfram LibraryLink and the Wolfram Language

wolfram-library-link Bindings to the Wolfram LibraryLink interface, making it possible to call Rust code from the Wolfram Language. This library is us

Wolfram Research, Inc. 28 Dec 6, 2022
This blog provides detailed status updates and useful information about Theseus OS and its development

The Theseus OS Blog This blog provides detailed status updates and useful information about Theseus OS and its development. Attribution This blog was

Theseus OS 1 Apr 14, 2022
Omeglib, a portmanteau of "omegle" and "library", is a crate for interacting with omegle, simply and asynchronously

Omeglib, a portmanteau of "omegle" and "library", is a crate for interacting with omegle, simply and asynchronously. It is intended to suit one's every requirement regarding chat on omegle.

null 1 May 25, 2022
Fast and simple datetime, date, time and duration parsing for rust.

speedate Fast and simple datetime, date, time and duration parsing for rust. speedate is a lax† RFC 3339 date and time parser, in other words, it pars

Samuel Colvin 43 Nov 25, 2022
In this repository you can find modules with code and comments that explain rust syntax and all about Rust lang.

Learn Rust What is this? In this repository you can find modules with code and comments that explain rust syntax and all about Rust lang. This is usef

Domagoj Ratko 5 Nov 5, 2022
A tool and library to losslessly join multiple .mp4 files shot with same camera and settings

mp4-merge A tool and library to losslessly join multiple .mp4 files shot with same camera and settings. This is useful to merge multiple files that ar

Gyroflow 7 Jan 2, 2023
A tray application for Windows that gives you push notifications and instant downloads of new posts, messages and stories posted by models you subscribe to on Onlyfans.

OF-notifier A tray application for Windows that gives you push notifications and instant downloads of new posts, messages and stories posted by models

Gentlemen Mercenary 10 Dec 20, 2022
A simpler and 5x faster alternative to HashMap in Rust, which doesn't use hashing and doesn't use heap

At least 5x faster alternative of HashMap, for very small maps. It is also faster than FxHashMap, hashbrown, ArrayMap, and nohash-hasher. The smaller

Yegor Bugayenko 12 Apr 19, 2023
A comprehensive and FREE Online Rust hacking tutorial utilizing the x64, ARM64 and ARM32 architectures going step-by-step into the world of reverse engineering Rust from scratch.

FREE Reverse Engineering Self-Study Course HERE Hacking Rust A comprehensive and FREE Online Rust hacking tutorial utilizing the x64, ARM64 and ARM32

Kevin Thomas 98 Jun 21, 2023