42 lines
1.1 KiB
QML
42 lines
1.1 KiB
QML
import Quickshell.Services.Pipewire
|
|
import Quickshell.Io
|
|
import QtQuick
|
|
import qs
|
|
|
|
Rectangle {
|
|
id: root
|
|
color: Appearance.colAppBg
|
|
property PwNode defaultAudio: Pipewire.ready ? Pipewire.preferredDefaultAudioSink : null
|
|
property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null
|
|
radius: Appearance.appletRadHeight
|
|
implicitHeight: Appearance.appletRadHeight
|
|
implicitWidth: pwText.implicitWidth + 25
|
|
PwObjectTracker {
|
|
objects: [Pipewire.ready ? Pipewire.defaultAudioSink : null]
|
|
}
|
|
|
|
Process {
|
|
id: pavuLauncher
|
|
command: ["pavucontrol"]
|
|
running: false
|
|
}
|
|
|
|
Text {
|
|
id: pwText
|
|
font.family: Appearance.font
|
|
font.pixelSize: Appearance.fontSize
|
|
font.bold: true
|
|
color: Appearance.colFg
|
|
anchors.centerIn: root
|
|
text: root.mute ? "MUT: " + Math.floor(root.defaultAudio?.audio.volume * 100) + "%" : "VOL: " + Math.floor(root.defaultAudio?.audio.volume * 100) + "%"
|
|
opacity: root.defaultAudio?.audio.muted ? 0.6 : 1.0
|
|
}
|
|
MouseArea {
|
|
id: clickHandler
|
|
hoverEnabled: true
|
|
acceptedButtons: Qt.LeftButton
|
|
cursorShape: Qt.PointingHandCursor
|
|
anchors.fill: root
|
|
onClicked: pavuLauncher.running = true
|
|
}
|
|
}
|