Very minimal volume widget and PWAudioService
This commit is contained in:
parent
56777fc9fd
commit
5c7268aaee
7 changed files with 326 additions and 234 deletions
30
Services/PipeWireAudio.qml
Normal file
30
Services/PipeWireAudio.qml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.Pipewire
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
// Ensure the volume is readonly from outside
|
||||
readonly property alias volume: root._volume
|
||||
property real _volume: 0
|
||||
|
||||
readonly property alias muted: root._muted
|
||||
property bool _muted: false
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [Pipewire.defaultAudioSink]
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Pipewire.defaultAudioSink?.audio ? Pipewire.defaultAudioSink?.audio : null
|
||||
|
||||
function onVolumeChanged() {
|
||||
root._volume = (Pipewire.defaultAudioSink?.audio.volume ?? 0)
|
||||
console.log("onVolumeChanged: " + volume)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue