diff --git a/Cargo.toml b/Cargo.toml index 21c8e47..27b626f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,16 +9,21 @@ gethostname = "0.4.1" wayland-client = "0.30.1" wayland-scanner = "0.30" wayland-backend = "0.1" +x11rb = { version = "0.11.1", features = ["screensaver"] } +zbus = {version = "3.11.1", optional = true} chrono = "0.4.24" -serde_json = "1.0.95" -zbus = "3.11.1" +toml = "0.7.3" clap = { version = "4.2.1", features = ["string"] } log = { version = "0.4.17", features = ["std"] } fern = { version = "0.6.2", features = ["colored"] } -x11rb = { version = "0.11.1", features = ["screensaver"] } -toml = "0.7.3" dirs = "5.0.0" serde = { version = "1.0.160", features = ["derive"] } serde_default = "0.1.0" +serde_json = "1.0.95" regex = "1.8.1" anyhow = "1.0.70" + +[features] +default = ["gnome", "kwin_window"] +gnome = ["zbus"] +kwin_window = ["zbus"] diff --git a/README.md b/README.md index 8a6388f..4d910a8 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ and to add more flexibility to reports. - `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](https://github.com/ActivityWatch/aw-watcher-web) (Firefox, Chrome etc). diff --git a/src/watchers.rs b/src/watchers.rs index bf95c38..9eb1c99 100644 --- a/src/watchers.rs +++ b/src/watchers.rs @@ -1,6 +1,9 @@ +#[cfg(feature = "gnome")] mod gnome_idle; +#[cfg(feature = "gnome")] mod gnome_window; mod idle; +#[cfg(feature = "kwin_window")] mod kwin_window; mod wl_bindings; mod wl_connection; @@ -52,13 +55,16 @@ macro_rules! watcher { pub const IDLE: &WatcherConstructors = &[ watcher!(wl_kwin_idle::IdleWatcher), watcher!(x11_screensaver_idle::IdleWatcher), + #[cfg(feature = "gnome")] watcher!(gnome_idle::IdleWatcher), ]; pub const ACTIVE_WINDOW: &WatcherConstructors = &[ watcher!(wl_foreign_toplevel::WindowWatcher), // XWayland gives _NET_WM_NAME on some windows in KDE, but not on others + #[cfg(feature = "kwin_window")] watcher!(kwin_window::WindowWatcher), watcher!(x11_window::WindowWatcher), + #[cfg(feature = "gnome")] watcher!(gnome_window::WindowWatcher), ];