diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2026-03-12 22:30:28 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2026-03-12 22:30:28 +1100 |
| commit | 6987809a7620d44577d072c5d9418a7f5bf1afe8 (patch) | |
| tree | 52eb291c8f9db264e3e5ed203706746b6f091bdc | |
| parent | notifs: add sourceSize to notification images (diff) | |
| download | caelestia-shell-6987809a7620d44577d072c5d9418a7f5bf1afe8.tar.gz caelestia-shell-6987809a7620d44577d072c5d9418a7f5bf1afe8.tar.bz2 caelestia-shell-6987809a7620d44577d072c5d9418a7f5bf1afe8.zip | |
brightness: use map lookup for DDC monitor matching
| -rw-r--r-- | services/Brightness.qml | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/services/Brightness.qml b/services/Brightness.qml index 12920ee..7eb7d51 100644 --- a/services/Brightness.qml +++ b/services/Brightness.qml @@ -11,6 +11,12 @@ Singleton { id: root property list<var> ddcMonitors: [] + readonly property var ddcMonitorMap: { + const map = {}; + for (const m of ddcMonitors) + map[m.connector] = m; + return map; + } readonly property list<Monitor> monitors: variants.instances property bool appleDisplayPresent: false @@ -155,8 +161,9 @@ Singleton { id: monitor required property ShellScreen modelData - readonly property bool isDdc: root.ddcMonitors.some(m => m.connector === modelData.name) - readonly property string busNum: root.ddcMonitors.find(m => m.connector === modelData.name)?.busNum ?? "" + readonly property var ddcInfo: root.ddcMonitorMap[modelData.name] ?? null + readonly property bool isDdc: ddcInfo !== null + readonly property string busNum: ddcInfo?.busNum ?? "" readonly property bool isAppleDisplay: root.appleDisplayPresent && modelData.model.startsWith("StudioDisplay") property real brightness property real queuedBrightness: NaN |