add popup for audio management
This commit is contained in:
parent
f409062ba6
commit
5005ba24db
11 changed files with 298 additions and 120 deletions
|
|
@ -9,6 +9,7 @@ import QtQuick.Effects
|
|||
import qs
|
||||
import qs.widgets
|
||||
import qs.settings
|
||||
import qs.modules.Services
|
||||
|
||||
BarComponent {
|
||||
id: root
|
||||
|
|
@ -17,50 +18,23 @@ BarComponent {
|
|||
property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null
|
||||
implicitHeight: Config.moduleHeight
|
||||
implicitWidth: pwLayout.implicitWidth + 16
|
||||
function getVolumeIcon() {
|
||||
let volume = Pipewire.ready ? root.defaultAudio.audio.volume : null;
|
||||
if (root.mute) {
|
||||
return "audio-volume-muted";
|
||||
}
|
||||
if (volume <= 0.33) {
|
||||
return "audio-volume-low";
|
||||
}
|
||||
if (volume <= 0.66) {
|
||||
return "audio-volume-medium";
|
||||
}
|
||||
if (volume >= 0.66) {
|
||||
return "audio-volume-high";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [Pipewire.ready ? Pipewire.defaultAudioSink : null]
|
||||
}
|
||||
|
||||
Process {
|
||||
id: pavuLauncher
|
||||
command: ["pavucontrol"]
|
||||
running: false
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: pwLayout
|
||||
anchors.centerIn: root
|
||||
spacing: 4
|
||||
IconImage {
|
||||
source: Quickshell.iconPath(root.getVolumeIcon() + "-symbolic", root.getVolumeIcon())
|
||||
implicitSize: 14
|
||||
layer.enabled: true
|
||||
layer.effect: MultiEffect {
|
||||
colorization: 1.0
|
||||
colorizationColor: Colors.text
|
||||
brightness: 0.5
|
||||
}
|
||||
}
|
||||
IconImage {
|
||||
source: Quickshell.iconPath(Audio.getVolumeIcon(Audio.defaultAudio))
|
||||
implicitSize: 14
|
||||
layer.enabled: true
|
||||
layer.effect: MultiEffect {
|
||||
colorization: 1.0
|
||||
colorizationColor: Colors.text
|
||||
brightness: 0.5
|
||||
}
|
||||
}
|
||||
StyledText {
|
||||
text: Math.round(root.defaultAudio?.audio.volume * 100) + "%"
|
||||
opacity: root.defaultAudio?.audio.muted ? 0.6 : 1.0
|
||||
text: Audio.percentage + "%"
|
||||
opacity: Audio.muted ? 0.6 : 1.0
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
|
|
@ -71,35 +45,8 @@ BarComponent {
|
|||
anchors.fill: root
|
||||
onClicked: volPopup.visible = !volPopup.visible
|
||||
}
|
||||
PopupWindow {
|
||||
VolPopup {
|
||||
id: volPopup
|
||||
anchor.item: root
|
||||
implicitWidth: 250
|
||||
implicitHeight: 600
|
||||
|
||||
anchor.edges: Edges.Top
|
||||
anchor.gravity: Edges.Bottom
|
||||
anchor.margins.top: 40
|
||||
color: 'transparent'
|
||||
Rectangle {
|
||||
id: test
|
||||
anchors.fill: parent
|
||||
color: Colors.activeModuleBg
|
||||
radius: Config.rounding
|
||||
ListView {
|
||||
id: sourceLayout
|
||||
|
||||
model: Pipewire.nodes
|
||||
delegate: Rectangle {
|
||||
implicitHeight: 10
|
||||
|
||||
required property var modelData
|
||||
StyledText {
|
||||
text: parent.modelData.nickname
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue