mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
OSD: fix initial output volume osd
This commit is contained in:
+23
-6
@@ -34,6 +34,7 @@ Variants {
|
|||||||
readonly property bool isMuted: AudioService.muted
|
readonly property bool isMuted: AudioService.muted
|
||||||
property bool volumeInitialized: false
|
property bool volumeInitialized: false
|
||||||
property bool muteInitialized: false
|
property bool muteInitialized: false
|
||||||
|
property real lastKnownVolume: -1 // Track last known volume to detect actual changes
|
||||||
|
|
||||||
// Input volume properties
|
// Input volume properties
|
||||||
readonly property real currentInputVolume: AudioService.inputVolume
|
readonly property real currentInputVolume: AudioService.inputVolume
|
||||||
@@ -498,15 +499,33 @@ Variants {
|
|||||||
target: AudioService
|
target: AudioService
|
||||||
|
|
||||||
function onVolumeChanged() {
|
function onVolumeChanged() {
|
||||||
if (volumeInitialized) {
|
// Capture initial volume on first change to avoid showing OSD on startup
|
||||||
|
if (lastKnownVolume < 0) {
|
||||||
|
lastKnownVolume = AudioService.volume
|
||||||
|
volumeInitialized = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!volumeInitialized) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Only show OSD if volume actually changed from last known value
|
||||||
|
if (Math.abs(AudioService.volume - lastKnownVolume) > 0.001) {
|
||||||
|
lastKnownVolume = AudioService.volume
|
||||||
showOSD("volume")
|
showOSD("volume")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMutedChanged() {
|
function onMutedChanged() {
|
||||||
if (muteInitialized) {
|
// Capture initial muted state on first change to avoid showing OSD on startup
|
||||||
showOSD("volume")
|
if (lastKnownVolume < 0) {
|
||||||
|
lastKnownVolume = AudioService.volume
|
||||||
|
muteInitialized = true
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
if (!muteInitialized) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
showOSD("volume")
|
||||||
}
|
}
|
||||||
|
|
||||||
function onInputVolumeChanged() {
|
function onInputVolumeChanged() {
|
||||||
@@ -552,9 +571,7 @@ Variants {
|
|||||||
interval: 500
|
interval: 500
|
||||||
running: true
|
running: true
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
volumeInitialized = true
|
// Volume and input volume initialize on first change to avoid showing OSD on startup
|
||||||
muteInitialized = true
|
|
||||||
// Input volume initializes on first change to avoid showing OSD on startup
|
|
||||||
// Brightness initializes on first change to avoid showing OSD on startup
|
// Brightness initializes on first change to avoid showing OSD on startup
|
||||||
connectBrightnessMonitors()
|
connectBrightnessMonitors()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user