Skip to content

Commit 84e2442

Browse files
authored
update for sysinfo 0.33 (#27)
1 parent 12e477c commit 84e2442

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[package]
22
name = "stats_provider"
3-
version = "0.6.2"
3+
version = "0.6.3"
44
description = "A simple system stats event provider for Sketchybar."
55
edition = "2021"
66
build = "build.rs"
77

88
[dependencies]
99
anyhow = "1.0.94"
1010
clap = { version = "4.5.23", features = ["derive"] }
11-
sysinfo = { version = "0.32.1", default-features = false, features = ["component", "disk", "network", "system"] }
11+
sysinfo = { version = "0.33.0", default-features = false, features = ["component", "disk", "network", "system"] }
1212
tokio = { version = "1", features = ["full"] }
1313

1414
[build-dependencies]

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ async fn get_stats(cli: &cli::Cli, sketchybar: &Sketchybar) -> Result<()> {
5050
let mut commands: Vec<String> = Vec::new();
5151
tokio::time::sleep(tokio::time::Duration::from_secs(cli.interval.into())).await;
5252
system.refresh_specifics(refresh_kind);
53-
disks.refresh();
54-
networks.refresh();
53+
disks.refresh(true);
54+
networks.refresh(true);
5555

5656
if cli.all {
5757
commands.push(get_cpu_stats(&system, &cli::all_cpu_flags()).join(""));

src/stats/cpu.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ pub fn get_cpu_stats(s: &System, flags: &[&str]) -> Vec<String> {
2929
.iter()
3030
.any(|&label| component.label().contains(label))
3131
{
32-
total_temp += component.temperature();
33-
count += 1;
32+
if let Some(temperature) = component.temperature() {
33+
total_temp += temperature;
34+
count += 1;
35+
}
3436
}
3537
}
3638

src/stats/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub use network::get_network_stats;
1313
pub use system::get_system_stats;
1414

1515
pub fn build_refresh_kind() -> RefreshKind {
16-
RefreshKind::new()
17-
.with_cpu(CpuRefreshKind::new().with_cpu_usage().with_frequency())
18-
.with_memory(MemoryRefreshKind::new().with_ram().with_swap())
16+
RefreshKind::nothing()
17+
.with_cpu(CpuRefreshKind::nothing().with_cpu_usage().with_frequency())
18+
.with_memory(MemoryRefreshKind::nothing().with_ram().with_swap())
1919
}

src/stats/system.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub fn get_system_stats(flags: &[&str]) -> Vec<String> {
55
for &flag in flags {
66
match flag {
77
"arch" => {
8-
result.push(format!("ARCH=\"{}\" ", System::cpu_arch().unwrap()));
8+
result.push(format!("ARCH=\"{}\" ", System::cpu_arch()));
99
}
1010
"distro" => {
1111
result.push(format!("DISTRO=\"{}\" ", System::distribution_id()));

0 commit comments

Comments
 (0)