mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Merge pull request #472 from lonerOrz/fix/osd-brightness
fix: Resolve intermittent OSD brightness display issue
This commit is contained in:
+4
-19
@@ -40,14 +40,8 @@ Variants {
|
|||||||
property bool inputMuteInitialized: false
|
property bool inputMuteInitialized: false
|
||||||
|
|
||||||
// Brightness properties
|
// Brightness properties
|
||||||
property bool brightnessInitialized: false
|
property real lastUpdatedBrightness: 0
|
||||||
property int brightnessChangeCount: 0
|
readonly property real currentBrightness: lastUpdatedBrightness
|
||||||
readonly property real currentBrightness: {
|
|
||||||
if (BrightnessService.monitors.length > 0) {
|
|
||||||
return BrightnessService.monitors[0].brightness || 0
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get appropriate icon based on current OSD type
|
// Get appropriate icon based on current OSD type
|
||||||
function getIcon() {
|
function getIcon() {
|
||||||
@@ -144,7 +138,6 @@ Variants {
|
|||||||
})()
|
})()
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
connectBrightnessMonitors()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
@@ -157,7 +150,6 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
disconnectBrightnessMonitors()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anchor selection based on location (window edges)
|
// Anchor selection based on location (window edges)
|
||||||
@@ -545,7 +537,6 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function connectBrightnessMonitors() {
|
function connectBrightnessMonitors() {
|
||||||
brightnessChangeCount = 0 // Reset change count when reconnecting
|
|
||||||
for (var i = 0; i < BrightnessService.monitors.length; i++) {
|
for (var i = 0; i < BrightnessService.monitors.length; i++) {
|
||||||
let monitor = BrightnessService.monitors[i]
|
let monitor = BrightnessService.monitors[i]
|
||||||
// Disconnect first to avoid duplicate connections
|
// Disconnect first to avoid duplicate connections
|
||||||
@@ -555,14 +546,8 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onBrightnessChanged(newBrightness) {
|
function onBrightnessChanged(newBrightness) {
|
||||||
brightnessChangeCount++
|
root.lastUpdatedBrightness = newBrightness
|
||||||
|
showOSD("brightness")
|
||||||
if (brightnessChangeCount <= BrightnessService.monitors.length) {
|
|
||||||
// This is likely the initial brightness value(s), don't show OSD
|
|
||||||
brightnessInitialized = true
|
|
||||||
} else {
|
|
||||||
showOSD("brightness")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showOSD(type) {
|
function showOSD(type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user