diff --git a/config/dot/quickshell/modules/quicksettings/BrightnessControl.qml b/config/dot/quickshell/modules/quicksettings/BrightnessControl.qml index bf70cef..ce038a1 100644 --- a/config/dot/quickshell/modules/quicksettings/BrightnessControl.qml +++ b/config/dot/quickshell/modules/quicksettings/BrightnessControl.qml @@ -34,11 +34,23 @@ Item { visible: root.rowCount > 0 implicitHeight: rows.implicitHeight - // Probing I2C takes on the order of a second, so it waits until the panel - // is actually on screen rather than running at shell startup. Monitors do - // not come and go, so once is enough. - onVisibleChanged: if (visible && !Brightness.scanned) Brightness.refresh() - Component.onCompleted: if (root.visible && !Brightness.scanned) Brightness.refresh() + // Probing I2C takes on the order of a second, so it waits until the quick + // settings panel is actually on screen rather than running at shell + // startup. Monitors do not come and go, so once is enough. + // + // The trigger is the panel opening, not this item becoming visible: on a + // machine with no backlight, `visible` stays false until a scan has found + // a DDC display, so keying the scan off it would never scan at all. + Connections { + target: ShellState + function onQuickSettingsOpenChanged(): void { root.scanIfOpen(); } + } + Component.onCompleted: root.scanIfOpen() + + function scanIfOpen(): void { + if (ShellState.quickSettingsOpen && !Brightness.scanned) + Brightness.refresh(); + } // `-m` is the machine-readable form: name,class,current,percent,max Process {