feat(ags binto): fix caps lock osd
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-03-24 17:23:38 -04:00
parent 3f0d4bb691
commit dbac899437
2 changed files with 15 additions and 3 deletions

View file

@ -1,4 +1,5 @@
import Pointers from './services/pointers.ts'; import Pointers from './services/pointers.ts';
import Brightness from './services/brightness.ts';
import AppLauncher from './ts/applauncher/main.ts'; import AppLauncher from './ts/applauncher/main.ts';
import Bar from './ts/bar/binto.ts'; import Bar from './ts/bar/binto.ts';
@ -13,6 +14,9 @@ App.config({
onConfigParsed: () => { onConfigParsed: () => {
globalThis.Pointers = Pointers; globalThis.Pointers = Pointers;
Brightness.capsName = 'input30::capslock';
globalThis.Brightness = Brightness;
}, },
windows: () => [ windows: () => [

View file

@ -1,7 +1,6 @@
const { exec, execAsync } = Utils; const { exec, execAsync } = Utils;
const KBD = 'tpacpi::kbd_backlight'; const KBD = 'tpacpi::kbd_backlight';
const CAPS = 'input0::capslock';
const INTERVAL = 500; const INTERVAL = 500;
const SCREEN_ICONS = { const SCREEN_ICONS = {
90: 'display-brightness-high-symbolic', 90: 'display-brightness-high-symbolic',
@ -26,9 +25,18 @@ class Brightness extends Service {
#kbdMax = 0; #kbdMax = 0;
#screen = 0; #screen = 0;
#screenIcon = 'display-brightness-symbolic'; #screenIcon = 'display-brightness-symbolic';
#capsName = 'input0::capslock';
#caps = 0; #caps = 0;
#capsIcon = 'caps-lock-symbolic'; #capsIcon = 'caps-lock-symbolic';
get capsName() {
return this.#capsName;
}
set capsName(value: string) {
this.#capsName = value;
}
get kbd() { get kbd() {
return this.#kbd; return this.#kbd;
} }
@ -85,7 +93,7 @@ class Brightness extends Service {
try { try {
this.#monitorKbdState(); this.#monitorKbdState();
this.#kbdMax = Number(exec(`brightnessctl -d ${KBD} m`)); 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')) / this.#screen = Number(exec('brightnessctl g')) /
Number(exec('brightnessctl m')); Number(exec('brightnessctl m'));
} }
@ -107,7 +115,7 @@ class Brightness extends Service {
} }
fetchCapsState() { fetchCapsState() {
execAsync(`brightnessctl -d ${CAPS} g`) execAsync(`brightnessctl -d ${this.#capsName} g`)
.then((out) => { .then((out) => {
this.#caps = Number(out); this.#caps = Number(out);
this.#capsIcon = this.#caps ? this.#capsIcon = this.#caps ?