Mark DBus modules as features

This commit is contained in:
Demmie 2023-04-29 02:45:21 -04:00
parent a797199219
commit caad19e60b
No known key found for this signature in database
GPG Key ID: B06DAA3D432C6E9A
3 changed files with 18 additions and 4 deletions

View File

@ -9,16 +9,21 @@ gethostname = "0.4.1"
wayland-client = "0.30.1" wayland-client = "0.30.1"
wayland-scanner = "0.30" wayland-scanner = "0.30"
wayland-backend = "0.1" wayland-backend = "0.1"
x11rb = { version = "0.11.1", features = ["screensaver"] }
zbus = {version = "3.11.1", optional = true}
chrono = "0.4.24" chrono = "0.4.24"
serde_json = "1.0.95" toml = "0.7.3"
zbus = "3.11.1"
clap = { version = "4.2.1", features = ["string"] } clap = { version = "4.2.1", features = ["string"] }
log = { version = "0.4.17", features = ["std"] } log = { version = "0.4.17", features = ["std"] }
fern = { version = "0.6.2", features = ["colored"] } fern = { version = "0.6.2", features = ["colored"] }
x11rb = { version = "0.11.1", features = ["screensaver"] }
toml = "0.7.3"
dirs = "5.0.0" dirs = "5.0.0"
serde = { version = "1.0.160", features = ["derive"] } serde = { version = "1.0.160", features = ["derive"] }
serde_default = "0.1.0" serde_default = "0.1.0"
serde_json = "1.0.95"
regex = "1.8.1" regex = "1.8.1"
anyhow = "1.0.70" anyhow = "1.0.70"
[features]
default = ["gnome", "kwin_window"]
gnome = ["zbus"]
kwin_window = ["zbus"]

View File

@ -18,6 +18,9 @@ and to add more flexibility to reports.
- `cargo build --release` in the root of the repository. - `cargo build --release` in the root of the repository.
- The target file will be located at `target/release/awatcher`. - 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 To track your activities in browsers install the plugin for your browser from
[here](https://github.com/ActivityWatch/aw-watcher-web) (Firefox, Chrome etc). [here](https://github.com/ActivityWatch/aw-watcher-web) (Firefox, Chrome etc).

View File

@ -1,6 +1,9 @@
#[cfg(feature = "gnome")]
mod gnome_idle; mod gnome_idle;
#[cfg(feature = "gnome")]
mod gnome_window; mod gnome_window;
mod idle; mod idle;
#[cfg(feature = "kwin_window")]
mod kwin_window; mod kwin_window;
mod wl_bindings; mod wl_bindings;
mod wl_connection; mod wl_connection;
@ -52,13 +55,16 @@ macro_rules! watcher {
pub const IDLE: &WatcherConstructors = &[ pub const IDLE: &WatcherConstructors = &[
watcher!(wl_kwin_idle::IdleWatcher), watcher!(wl_kwin_idle::IdleWatcher),
watcher!(x11_screensaver_idle::IdleWatcher), watcher!(x11_screensaver_idle::IdleWatcher),
#[cfg(feature = "gnome")]
watcher!(gnome_idle::IdleWatcher), watcher!(gnome_idle::IdleWatcher),
]; ];
pub const ACTIVE_WINDOW: &WatcherConstructors = &[ pub const ACTIVE_WINDOW: &WatcherConstructors = &[
watcher!(wl_foreign_toplevel::WindowWatcher), watcher!(wl_foreign_toplevel::WindowWatcher),
// XWayland gives _NET_WM_NAME on some windows in KDE, but not on others // XWayland gives _NET_WM_NAME on some windows in KDE, but not on others
#[cfg(feature = "kwin_window")]
watcher!(kwin_window::WindowWatcher), watcher!(kwin_window::WindowWatcher),
watcher!(x11_window::WindowWatcher), watcher!(x11_window::WindowWatcher),
#[cfg(feature = "gnome")]
watcher!(gnome_window::WindowWatcher), watcher!(gnome_window::WindowWatcher),
]; ];