feat: add volume change OSD modules for audio sink and source and added Default Sink and Source to the Bar
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pipewire
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [ Pipewire.defaultAudioSink ]
|
||||
}
|
||||
|
||||
property var audioSink: Pipewire.defaultAudioSink
|
||||
|
||||
property bool exists: audioSink != null
|
||||
property bool mute: audioSink?.audio?.muted ?? false
|
||||
property real volume: Math.round((audioSink?.audio?.volume ?? 0) * 1000) / 10
|
||||
|
||||
property bool volumeChanged: false
|
||||
|
||||
Connections {
|
||||
target: audioSink?.audio
|
||||
|
||||
function onVolumeChanged() {
|
||||
root.volumeChanged = true;
|
||||
hideTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
interval: 1000
|
||||
onTriggered: root.volumeChanged = false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pipewire
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [ Pipewire.defaultAudioSource ]
|
||||
}
|
||||
|
||||
property var audioSource: Pipewire.defaultAudioSource
|
||||
|
||||
property bool exists: audioSource != null
|
||||
property bool mute: audioSource?.audio?.muted ?? false
|
||||
property real volume: Math.round((audioSource?.audio?.volume ?? 0) * 1000) / 10
|
||||
|
||||
property bool volumeChanged: false
|
||||
|
||||
Connections {
|
||||
target: audioSource?.audio
|
||||
|
||||
function onVolumeChanged() {
|
||||
root.volumeChanged = true;
|
||||
hideTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
interval: 1000
|
||||
onTriggered: root.volumeChanged = false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
singleton Sink DefaultSinkState.qml
|
||||
singleton Source DefaultSourceState.qml
|
||||
Reference in New Issue
Block a user