From db00b3b2c70137b61e7b2abf9ff7b3acb2c35fc7 Mon Sep 17 00:00:00 2001 From: tr1x_em Date: Thu, 31 Jul 2025 21:36:03 +0530 Subject: [PATCH] Gpugetting fixed --- modules/about.py | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/modules/about.py b/modules/about.py index 257a025..13a460f 100644 --- a/modules/about.py +++ b/modules/about.py @@ -8,6 +8,7 @@ from fabric.widgets.box import Box from widgets.wayland import WaylandWindow as Window from fabric.utils.helpers import exec_shell_command_async, get_relative_path from gi.repository import Gtk, GdkPixbuf # type: ignore +import GPUtil def read_dmi(field): @@ -18,33 +19,11 @@ def read_dmi(field): return "Unknown" +# TODO: Remove GPUtil dependency if not needed? (maybe?) def get_gpu_name(): - try: - output = ( - subprocess.check_output( - "lspci -nn | grep -i 'VGA compatible controller'", shell=True, text=True - ) - .strip() - .split("\n") - ) - - def clean(line): - matches = re.findall(r"\[(.*?)\]", line) - if len(matches) >= 2: - return matches[1].strip() - desc = line.split(":", 2)[-1] - return desc.replace("Corporation", "").strip() - - for line in output: - if any(vendor in line.lower() for vendor in ["nvidia", "amd", "radeon"]): - return clean(line) - - if output: - return clean(output[0]) - - return "Unknown GPU" - except Exception: - return "Unknown GPU" + gpus = GPUtil.getGPUs() + if gpus: + return gpus[0].name.strip() class About(Gtk.Window): -- 2.43.0