mirror of
https://github.com/2e3s/awatcher.git
synced 2025-06-06 19:45:30 +00:00
Replace smol with tokio
This commit is contained in:
parent
665924d39e
commit
1c42466cbb
73
Cargo.lock
generated
73
Cargo.lock
generated
@ -151,19 +151,6 @@ dependencies = [
|
|||||||
"futures-core",
|
"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]]
|
[[package]]
|
||||||
name = "async-executor"
|
name = "async-executor"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
@ -219,36 +206,6 @@ dependencies = [
|
|||||||
"event-listener",
|
"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]]
|
[[package]]
|
||||||
name = "async-recursion"
|
name = "async-recursion"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
@ -451,7 +408,6 @@ name = "awatcher"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-compat",
|
|
||||||
"aw-datastore",
|
"aw-datastore",
|
||||||
"aw-server",
|
"aw-server",
|
||||||
"chrono",
|
"chrono",
|
||||||
@ -463,7 +419,7 @@ dependencies = [
|
|||||||
"open",
|
"open",
|
||||||
"rust-embed",
|
"rust-embed",
|
||||||
"signal-hook",
|
"signal-hook",
|
||||||
"smol",
|
"tokio",
|
||||||
"toml 0.7.3",
|
"toml 0.7.3",
|
||||||
"watchers",
|
"watchers",
|
||||||
]
|
]
|
||||||
@ -3160,23 +3116,6 @@ version = "1.10.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
|
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]]
|
[[package]]
|
||||||
name = "socket2"
|
name = "socket2"
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
@ -3392,9 +3331,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.27.0"
|
version = "1.28.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001"
|
checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"bytes",
|
"bytes",
|
||||||
@ -3405,14 +3344,14 @@ dependencies = [
|
|||||||
"signal-hook-registry",
|
"signal-hook-registry",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tokio-macros",
|
"tokio-macros",
|
||||||
"windows-sys 0.45.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-macros"
|
name = "tokio-macros"
|
||||||
version = "2.0.0"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce"
|
checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.54",
|
"proc-macro2 1.0.54",
|
||||||
"quote 1.0.26",
|
"quote 1.0.26",
|
||||||
|
@ -33,16 +33,15 @@ signal-hook = "0.3.15"
|
|||||||
ksni = {version = "0.2.0", optional = true}
|
ksni = {version = "0.2.0", optional = true}
|
||||||
aw-server = { git = "https://github.com/2e3s/aw-server-rust", optional = true, rev = "b967a56" }
|
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" }
|
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 }
|
open = { version = "4.1.0", optional = true }
|
||||||
rust-embed = { version = "6.6.1", features = ["interpolate-folder-path"] }
|
rust-embed = { version = "6.6.1", features = ["interpolate-folder-path"] }
|
||||||
|
tokio = { version = "1.28.2", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["gnome", "kwin_window"]
|
default = ["gnome", "kwin_window"]
|
||||||
gnome = ["watchers/gnome"]
|
gnome = ["watchers/gnome"]
|
||||||
kwin_window = ["watchers/kwin_window"]
|
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]
|
[package.metadata.deb]
|
||||||
features = ["bundle"]
|
features = ["bundle"]
|
||||||
|
@ -22,7 +22,7 @@ impl ksni::Tray for Tray {
|
|||||||
fn menu(&self) -> Vec<ksni::MenuItem<Self>> {
|
fn menu(&self) -> Vec<ksni::MenuItem<Self>> {
|
||||||
vec![
|
vec![
|
||||||
ksni::menu::StandardItem {
|
ksni::menu::StandardItem {
|
||||||
label: "Statistics".into(),
|
label: "ActivityWatch".into(),
|
||||||
// https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
|
// https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
|
||||||
icon_name: "document-properties".into(),
|
icon_name: "document-properties".into(),
|
||||||
activate: {
|
activate: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use async_compat::Compat;
|
|
||||||
use aw_server::endpoints::{build_rocket, embed_asset_resolver};
|
use aw_server::endpoints::{build_rocket, embed_asset_resolver};
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
@ -23,7 +22,11 @@ pub fn run(port: u32) {
|
|||||||
device_id,
|
device_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
let future = build_rocket(server_state, config).launch();
|
tokio::runtime::Builder::new_current_thread()
|
||||||
smol::block_on(Compat::new(future)).unwrap();
|
.enable_all()
|
||||||
|
.build()
|
||||||
|
.unwrap()
|
||||||
|
.block_on(build_rocket(server_state, config).launch())
|
||||||
|
.unwrap();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user