495 current 2024-04-28 20:50:10 24.05.20240428.30ddacc 6.8.6-zen1 *

This commit is contained in:
zackartz 2024-04-28 20:50:20 -04:00
parent 5549a17e4c
commit d6c181bc5b
No known key found for this signature in database
GPG key ID: 5B53E53A9A514DBA
46 changed files with 1685 additions and 10 deletions

View file

@ -0,0 +1,49 @@
import { Service, Utils } from "../imports.js";
class Brightness extends Service {
static {
Service.register(
this,
{},
{
screen: ["float", "rw"],
},
);
}
_screen = 0;
get screen() {
return this._screen;
}
set screen(percent) {
if (percent < 0) percent = 0;
if (percent > 1) percent = 1;
Utils.execAsync(`brightnessctl s ${percent * 100}% -q`)
.then(() => {
this._screen = percent;
this.changed("screen");
})
.catch(console.error);
}
constructor() {
super();
try {
this._screen =
Number(Utils.exec("brightnessctl g")) /
Number(Utils.exec("brightnessctl m"));
} catch (error) {
console.error("missing dependancy: brightnessctl");
}
}
}
const service = new Brightness();
globalThis.brightness = service;
export default service;