feat: added audio slider
Audio slider updates volume properly
This commit is contained in:
parent
b0e6ebc325
commit
f4f3b0714a
2 changed files with 48 additions and 1 deletions
41
src/AudioOutput.qml
Normal file
41
src/AudioOutput.qml
Normal file
|
@ -0,0 +1,41 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pipewire
|
||||
|
||||
// TODO: on click open detailed sink options:
|
||||
// - select default sink
|
||||
// - adjust sink & source volume
|
||||
// - mute sinks & sources
|
||||
|
||||
MouseArea {
|
||||
property PwNode sink: Pipewire.defaultAudioSink
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [sink]
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Text {
|
||||
id: label
|
||||
text: `${Math.round(sink.audio.volume * 100)}%`
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
Slider {
|
||||
id: slider
|
||||
|
||||
// BUG: For some reason need to hardcode the width as it is overflowing otherwise
|
||||
Layout.maximumWidth: 25
|
||||
|
||||
value: sink.audio.volume
|
||||
stepSize: 0.01
|
||||
wheelEnabled: true
|
||||
handle: Rectangle {}
|
||||
onMoved: sink.audio.volume = value
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,11 +15,17 @@ Scope {
|
|||
bottom: true
|
||||
}
|
||||
|
||||
width: 20
|
||||
width: 30
|
||||
|
||||
// the ClockWidget type we just created
|
||||
// TODO: on click open a calendar view
|
||||
ClockWidget {
|
||||
id: clock
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
AudioOutput {
|
||||
anchors.top: clock.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue