feat(ags brightness): add set for kbd
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
277377dc60
commit
ecc3d84f8b
1 changed files with 12 additions and 2 deletions
|
@ -25,6 +25,7 @@ class Brightness extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
#kbd = 0;
|
#kbd = 0;
|
||||||
|
#kbdMax = 0;
|
||||||
#screen = 0;
|
#screen = 0;
|
||||||
#screenIcon = 'display-brightness-symbolic';
|
#screenIcon = 'display-brightness-symbolic';
|
||||||
#caps = 0;
|
#caps = 0;
|
||||||
|
@ -51,8 +52,16 @@ class Brightness extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
set kbd(value) {
|
set kbd(value) {
|
||||||
|
if (value < 0 || value > this.#kbdMax) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
execAsync(`brightnessctl -d ${KBD} s ${value} -q`)
|
||||||
|
.then(() => {
|
||||||
this.#kbd = value;
|
this.#kbd = value;
|
||||||
// TODO
|
this.emit('kbd', this.#kbd);
|
||||||
|
})
|
||||||
|
.catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
set screen(percent) {
|
set screen(percent) {
|
||||||
|
@ -77,6 +86,7 @@ class Brightness extends Service {
|
||||||
super();
|
super();
|
||||||
try {
|
try {
|
||||||
this.#monitorKbdState();
|
this.#monitorKbdState();
|
||||||
|
this.#kbdMax = Number(exec(`brightnessctl -d ${KBD} m`));
|
||||||
this.#caps = Number(exec(`brightnessctl -d ${CAPS} g`));
|
this.#caps = Number(exec(`brightnessctl -d ${CAPS} g`));
|
||||||
this.#screen = Number(exec('brightnessctl g')) /
|
this.#screen = Number(exec('brightnessctl g')) /
|
||||||
Number(exec('brightnessctl m'));
|
Number(exec('brightnessctl m'));
|
||||||
|
|
Loading…
Reference in a new issue