1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-01 19:18:28 -04:00

brightness: avoid targeting inactive panels

fixes #1127
This commit is contained in:
bbedward
2026-07-04 20:28:13 -04:00
parent fefc0afa6f
commit 30ceda97a0
+13 -4
View File
@@ -228,7 +228,7 @@ Singleton {
if (deviceExists) {
setCurrentDevice(lastDevice, false);
} else {
const backlight = devices.find(d => d.class === "backlight");
const backlight = internalPanelActive() ? devices.find(d => d.class === "backlight") : null;
const nonKbdDevice = devices.find(d => !d.id.includes("kbd"));
const defaultDevice = backlight || nonKbdDevice || devices[0];
setCurrentDevice(defaultDevice.id, false);
@@ -363,12 +363,21 @@ Singleton {
return Math.round(normalizedPercent * 100.0);
}
function internalPanelActive() {
return Quickshell.screens.some(s => /^(eDP|LVDS|DSI)/i.test(s.name));
}
function getDefaultDevice() {
for (const device of devices) {
if (device.class === "backlight") {
return device.id;
if (internalPanelActive()) {
for (const device of devices) {
if (device.class === "backlight") {
return device.id;
}
}
}
const nonKbdDevice = devices.find(d => d.class !== "backlight" && !d.id.includes("kbd"));
if (nonKbdDevice)
return nonKbdDevice.id;
return devices.length > 0 ? devices[0].id : "";
}