diff --git a/cosmic-applet-battery/src/dgpu.rs b/cosmic-applet-battery/src/dgpu.rs index 11b6bb50..ab807131 100644 --- a/cosmic-applet-battery/src/dgpu.rs +++ b/cosmic-applet-battery/src/dgpu.rs @@ -222,7 +222,11 @@ impl Gpu { Some( smi_output .lines() - .filter(|line| !line.starts_with('#')) + .filter(|line| { + // smi shows an empty line filled with - when no app is running + let components = line.split_whitespace().collect::>(); + components[1].trim().ne("-") && !line.starts_with('#') + }) .map(|line| { let components = line.split_whitespace().collect::>(); let pid = components[1].trim();