Skip to content

Commit 93d9041

Browse files
committed
Review changes
1 parent 92ec72b commit 93d9041

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ tokio = { version = "1.47", features = ["rt-multi-thread", "macros", "time"] }
99
log = "0.4"
1010
simplelog = "0.12"
1111
sysinfo = "0.37"
12-
gfxinfo = { version = "0.1.2", features = ["default"] }
12+
gfxinfo = { version = "0.1", features = ["default"] }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ An OpenAction ([OpenDeck](https://github.com/nekename/OpenDeck) / [Tacto](https:
66

77
- CPU
88
- RAM
9+
- GPU
910
- Uptime
1011
- OS
11-
- GPU

assets/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"Name": "System Information",
33
"Author": "nekename",
4-
"Version": "1.0.1",
4+
"Version": "1.0.0",
55
"Category": "System Information",
66
"Icon": "icon",
77
"OS": [{ "Platform": "windows" }, { "Platform": "mac" }, { "Platform": "linux" }],

src/main.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ use std::collections::HashMap;
22

33
use openaction::*;
44

5-
use sysinfo::System;
6-
75
use gfxinfo::active_gpu;
6+
use sysinfo::System;
87

98
struct CPUAction;
109
#[async_trait]
@@ -90,6 +89,15 @@ async fn main() -> OpenActionResult<()> {
9089
let _ = instance.set_title(Some(ram_usage.clone()), None).await;
9190
}
9291

92+
let gpu_usage = if let Ok(gpu) = active_gpu() {
93+
format!("{:.0}%", gpu.info().load_pct())
94+
} else {
95+
"No GPU found".to_owned()
96+
};
97+
for instance in visible_instances(GPUAction::UUID).await {
98+
let _ = instance.set_title(Some(gpu_usage.clone()), None).await;
99+
}
100+
93101
{
94102
let total_secs = System::uptime();
95103
let days = total_secs / 86_400;
@@ -106,21 +114,14 @@ async fn main() -> OpenActionResult<()> {
106114
.await;
107115
}
108116
}
109-
110-
let gpu_usage = format!("{:.0}%", active_gpu().expect("REASON").info().load_pct());
111-
for instance in visible_instances(GPUAction::UUID).await {
112-
let _ = instance.set_title(Some(gpu_usage.clone()), None).await;
113-
}
114-
115-
116117
}
117118
});
118119

119120
register_action(CPUAction).await;
120121
register_action(RAMAction).await;
122+
register_action(GPUAction).await;
121123
register_action(UptimeAction).await;
122124
register_action(OSAction).await;
123-
register_action(GPUAction).await;
124125

125126
run(std::env::args().collect()).await
126127
}

0 commit comments

Comments
 (0)