1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 21:45:38 -05:00

audio: create and connect volume popup to IPCs

This commit is contained in:
bbedward
2025-07-25 11:24:27 -04:00
parent 1cf252599b
commit 786b8f3fa1
5 changed files with 294 additions and 21 deletions

View File

@@ -23,7 +23,6 @@ Column {
id: volumeSlider
width: parent.width
value: Math.round(root.volumeLevel)
minimum: 0
maximum: 100
leftIcon: root.volumeMuted ? "volume_off" : "volume_down"
@@ -32,16 +31,18 @@ Column {
showValue: true
unit: "%"
onSliderValueChanged: (newValue) => {
if (AudioService.sink && AudioService.sink.audio) {
AudioService.sink.audio.muted = false;
AudioService.sink.audio.volume = newValue / 100;
Connections {
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
function onVolumeChanged() {
volumeSlider.value = Math.round(AudioService.sink.audio.volume * 100);
}
}
// Add click handler for mute icon
Component.onCompleted: {
// Find the left icon and add mouse area
if (AudioService.sink && AudioService.sink.audio) {
value = Math.round(AudioService.sink.audio.volume * 100);
}
let leftIconItem = volumeSlider.children[0].children[0];
if (leftIconItem) {
let mouseArea = Qt.createQmlObject(
@@ -51,5 +52,12 @@ Column {
);
}
}
onSliderValueChanged: (newValue) => {
if (AudioService.sink && AudioService.sink.audio) {
AudioService.sink.audio.muted = false;
AudioService.sink.audio.volume = newValue / 100;
}
}
}
}