1
0
Fork 0

Add mostly final ags config

This commit is contained in:
Avery 2024-09-08 20:21:34 +02:00
parent c310042564
commit bce65f6835
Signed by: Avery
GPG key ID: B684FD451B692E04
23 changed files with 999 additions and 156 deletions

View file

@ -0,0 +1,43 @@
class GPUService extends Service {
static {
Service.register(
this,
{},
{ "current-usage": ["float", "r"], temperature: ["float", "r"] },
);
}
#currentUsage = 0;
#temperature = 0;
get current_usage() {
return this.#currentUsage;
}
get temperature() {
return this.#temperature;
}
constructor() {
super();
this.#update();
const interval = setInterval(() => {
this.#update();
}, 2000);
}
#update() {
this.#currentUsage = Utils.exec(
"sh -c 'cat /sys/class/drm/card?/device/gpu_busy_percent'",
);
this.#temperature =
Utils.exec(
"sh -c 'cat /sys/class/drm/card?/device/hwmon/hwmon?/temp1_input'",
) / 1000;
this.changed("current-usage");
this.changed("temperature");
}
}
const gpu = new GPUService();
export default gpu;