feat(ags binto): fix caps lock osd
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
3f0d4bb691
commit
dbac899437
2 changed files with 15 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
|||
import Pointers from './services/pointers.ts';
|
||||
import Brightness from './services/brightness.ts';
|
||||
|
||||
import AppLauncher from './ts/applauncher/main.ts';
|
||||
import Bar from './ts/bar/binto.ts';
|
||||
|
@ -13,6 +14,9 @@ App.config({
|
|||
|
||||
onConfigParsed: () => {
|
||||
globalThis.Pointers = Pointers;
|
||||
|
||||
Brightness.capsName = 'input30::capslock';
|
||||
globalThis.Brightness = Brightness;
|
||||
},
|
||||
|
||||
windows: () => [
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
const { exec, execAsync } = Utils;
|
||||
|
||||
const KBD = 'tpacpi::kbd_backlight';
|
||||
const CAPS = 'input0::capslock';
|
||||
const INTERVAL = 500;
|
||||
const SCREEN_ICONS = {
|
||||
90: 'display-brightness-high-symbolic',
|
||||
|
@ -26,9 +25,18 @@ class Brightness extends Service {
|
|||
#kbdMax = 0;
|
||||
#screen = 0;
|
||||
#screenIcon = 'display-brightness-symbolic';
|
||||
#capsName = 'input0::capslock';
|
||||
#caps = 0;
|
||||
#capsIcon = 'caps-lock-symbolic';
|
||||
|
||||
get capsName() {
|
||||
return this.#capsName;
|
||||
}
|
||||
|
||||
set capsName(value: string) {
|
||||
this.#capsName = value;
|
||||
}
|
||||
|
||||
get kbd() {
|
||||
return this.#kbd;
|
||||
}
|
||||
|
@ -85,7 +93,7 @@ class Brightness extends Service {
|
|||
try {
|
||||
this.#monitorKbdState();
|
||||
this.#kbdMax = Number(exec(`brightnessctl -d ${KBD} m`));
|
||||
this.#caps = Number(exec(`brightnessctl -d ${CAPS} g`));
|
||||
this.#caps = Number(exec(`bash -c brightnessctl -d ${this.#capsName} g`));
|
||||
this.#screen = Number(exec('brightnessctl g')) /
|
||||
Number(exec('brightnessctl m'));
|
||||
}
|
||||
|
@ -107,7 +115,7 @@ class Brightness extends Service {
|
|||
}
|
||||
|
||||
fetchCapsState() {
|
||||
execAsync(`brightnessctl -d ${CAPS} g`)
|
||||
execAsync(`brightnessctl -d ${this.#capsName} g`)
|
||||
.then((out) => {
|
||||
this.#caps = Number(out);
|
||||
this.#capsIcon = this.#caps ?
|
||||
|
|
Loading…
Reference in a new issue