summaryrefslogtreecommitdiff
path: root/src/services/gpu.ts
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-02-17 12:40:13 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-02-17 12:40:13 +1100
commit23779bdba1759bb10ad2af1d027f1274e4a833a6 (patch)
tree944e25bcb0cc6504375b4f2fc445e61b5383a1a6 /src/services/gpu.ts
parentlauncher: tod not installed notif action (diff)
downloadcaelestia-shell-23779bdba1759bb10ad2af1d027f1274e4a833a6.tar.gz
caelestia-shell-23779bdba1759bb10ad2af1d027f1274e4a833a6.tar.bz2
caelestia-shell-23779bdba1759bb10ad2af1d027f1274e4a833a6.zip
gpu: fix auto detection
Diffstat (limited to 'src/services/gpu.ts')
-rw-r--r--src/services/gpu.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/services/gpu.ts b/src/services/gpu.ts
index 916a2bc..179f14e 100644
--- a/src/services/gpu.ts
+++ b/src/services/gpu.ts
@@ -1,4 +1,4 @@
-import { execAsync, Gio, GObject, interval, property, register } from "astal";
+import { execAsync, Gio, GLib, GObject, interval, property, register } from "astal";
import { gpu as config } from "config";
@register({ GTypeName: "Gpu" })
@@ -24,10 +24,12 @@ export default class Gpu extends GObject.Object {
}
update() {
- this.calculateUsage().then(usage => {
- this.#usage = usage;
- this.notify("usage");
- });
+ this.calculateUsage()
+ .then(usage => {
+ this.#usage = usage;
+ this.notify("usage");
+ })
+ .catch(console.error);
}
constructor() {
@@ -44,7 +46,7 @@ export default class Gpu extends GObject.Object {
let info: Gio.FileInfo | undefined | null;
while ((info = enumerator?.next_file(null))) {
- if (/card[0-9]+/.test(info.get_name())) {
+ if (GLib.file_test(`/sys/class/drm/${info.get_name()}/device/gpu_busy_percent`, GLib.FileTest.EXISTS)) {
this.available = true;
break;
}