Skip to content

Commit 3670f12

Browse files
fix: show empty dropdown menu when no app uses dGPU
1 parent 941cbf5 commit 3670f12

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cosmic-applet-battery/src/dgpu.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,11 @@ impl Gpu {
222222
Some(
223223
smi_output
224224
.lines()
225-
.filter(|line| !line.starts_with('#'))
225+
.filter(|line| {
226+
// smi shows an empty line filled with - when no app is running
227+
let components = line.split_whitespace().collect::<Vec<_>>();
228+
components[1].trim().ne("-") && !line.starts_with('#')
229+
})
226230
.map(|line| {
227231
let components = line.split_whitespace().collect::<Vec<_>>();
228232
let pid = components[1].trim();

0 commit comments

Comments
 (0)