From 30ceda97a03e4d3eb0a685bb3d066e7dd5d35d6e Mon Sep 17 00:00:00 2001 From: bbedward Date: Sat, 4 Jul 2026 20:28:13 -0400 Subject: [PATCH] brightness: avoid targeting inactive panels fixes #1127 --- quickshell/Services/DisplayService.qml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/quickshell/Services/DisplayService.qml b/quickshell/Services/DisplayService.qml index 16ccbc30d..c7c1d6569 100644 --- a/quickshell/Services/DisplayService.qml +++ b/quickshell/Services/DisplayService.qml @@ -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 : ""; }