diff --git a/Cargo.lock b/Cargo.lock index 9c343e5..c91baab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,19 +151,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "async-compat" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b48b4ff0c2026db683dea961cd8ea874737f56cffca86fa84415eaddc51c00d" -dependencies = [ - "futures-core", - "futures-io", - "once_cell", - "pin-project-lite", - "tokio", -] - [[package]] name = "async-executor" version = "1.5.0" @@ -219,36 +206,6 @@ dependencies = [ "event-listener", ] -[[package]] -name = "async-net" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4051e67316bc7eff608fe723df5d32ed639946adcd69e07df41fd42a7b411f1f" -dependencies = [ - "async-io", - "autocfg", - "blocking", - "futures-lite", -] - -[[package]] -name = "async-process" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" -dependencies = [ - "async-io", - "async-lock", - "autocfg", - "blocking", - "cfg-if 1.0.0", - "event-listener", - "futures-lite", - "rustix", - "signal-hook", - "windows-sys 0.48.0", -] - [[package]] name = "async-recursion" version = "1.0.4" @@ -451,7 +408,6 @@ name = "awatcher" version = "0.1.0" dependencies = [ "anyhow", - "async-compat", "aw-datastore", "aw-server", "chrono", @@ -463,7 +419,7 @@ dependencies = [ "open", "rust-embed", "signal-hook", - "smol", + "tokio", "toml 0.7.3", "watchers", ] @@ -3160,23 +3116,6 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" -[[package]] -name = "smol" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13f2b548cd8447f8de0fdf1c592929f70f4fc7039a05e47404b0d096ec6987a1" -dependencies = [ - "async-channel", - "async-executor", - "async-fs", - "async-io", - "async-lock", - "async-net", - "async-process", - "blocking", - "futures-lite", -] - [[package]] name = "socket2" version = "0.4.9" @@ -3392,9 +3331,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.27.0" +version = "1.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" dependencies = [ "autocfg", "bytes", @@ -3405,14 +3344,14 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2 1.0.54", "quote 1.0.26", diff --git a/Cargo.toml b/Cargo.toml index a701eb7..3d825d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,16 +33,15 @@ signal-hook = "0.3.15" ksni = {version = "0.2.0", optional = true} aw-server = { git = "https://github.com/2e3s/aw-server-rust", optional = true, rev = "b967a56" } aw-datastore = { git = "https://github.com/2e3s/aw-server-rust", optional = true, rev = "b967a56" } -smol = {version = "1.3.0", optional = true } -async-compat = { version = "0.2.1", optional = true } open = { version = "4.1.0", optional = true } rust-embed = { version = "6.6.1", features = ["interpolate-folder-path"] } +tokio = { version = "1.28.2", optional = true } [features] default = ["gnome", "kwin_window"] gnome = ["watchers/gnome"] kwin_window = ["watchers/kwin_window"] -bundle = ["ksni", "smol", "async-compat", "aw-server", "aw-datastore", "open"] +bundle = ["ksni", "tokio", "aw-server", "aw-datastore", "open"] [package.metadata.deb] features = ["bundle"] diff --git a/src/bundle/menu.rs b/src/bundle/menu.rs index d684a25..67a473d 100644 --- a/src/bundle/menu.rs +++ b/src/bundle/menu.rs @@ -22,7 +22,7 @@ impl ksni::Tray for Tray { fn menu(&self) -> Vec> { vec![ ksni::menu::StandardItem { - label: "Statistics".into(), + label: "ActivityWatch".into(), // https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html icon_name: "document-properties".into(), activate: { diff --git a/src/bundle/server.rs b/src/bundle/server.rs index 9d408ea..0d6d821 100644 --- a/src/bundle/server.rs +++ b/src/bundle/server.rs @@ -1,5 +1,4 @@ use anyhow::anyhow; -use async_compat::Compat; use aw_server::endpoints::{build_rocket, embed_asset_resolver}; use std::sync::Mutex; @@ -23,7 +22,11 @@ pub fn run(port: u32) { device_id, }; - let future = build_rocket(server_state, config).launch(); - smol::block_on(Compat::new(future)).unwrap(); + tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .unwrap() + .block_on(build_rocket(server_state, config).launch()) + .unwrap(); }); }