Add mostly final ags config
This commit is contained in:
parent
c310042564
commit
bce65f6835
23 changed files with 999 additions and 156 deletions
|
@ -1,16 +1,25 @@
|
|||
class CPUService extends Service {
|
||||
static {
|
||||
Service.register(this, {}, { "current-usage": ["float", "r"] });
|
||||
Service.register(
|
||||
this,
|
||||
{},
|
||||
{ "current-usage": ["float", "r"], temperature: ["float", "r"] },
|
||||
);
|
||||
}
|
||||
|
||||
#previousIdle = 0.0;
|
||||
#previousTotal = 0.0;
|
||||
#currentUsage = 0.0;
|
||||
#temperature = 0.0;
|
||||
|
||||
get current_usage() {
|
||||
return this.#currentUsage;
|
||||
}
|
||||
|
||||
get temperature() {
|
||||
return this.#temperature;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.#update();
|
||||
|
@ -20,6 +29,10 @@ class CPUService extends Service {
|
|||
}
|
||||
|
||||
#update() {
|
||||
this.#temperature =
|
||||
Utils.exec(
|
||||
"sh -c 'cat /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon1/temp1_input'",
|
||||
) / 1000;
|
||||
const currentValues = Utils.exec(
|
||||
"sh -c 'cat /proc/stat | grep cpu | head -n 1 | tr -s \" \"'",
|
||||
)
|
||||
|
@ -33,6 +46,7 @@ class CPUService extends Service {
|
|||
this.#previousIdle = idle;
|
||||
this.#previousTotal = total;
|
||||
this.changed("current-usage");
|
||||
this.changed("temperature");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue