fix: show empty dropdown menu when no app uses dGPU

This commit is contained in:
Grooble 2024-09-24 15:52:53 +02:00 committed by GitHub
parent 941cbf546b
commit 3670f124fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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::<Vec<_>>();
components[1].trim().ne("-") && !line.starts_with('#')
})
.map(|line| {
let components = line.split_whitespace().collect::<Vec<_>>();
let pid = components[1].trim();