finish volume widget
This commit is contained in:
parent
5005ba24db
commit
c4ad2cee18
3 changed files with 12 additions and 7 deletions
|
|
@ -6,7 +6,7 @@ import Quickshell.Services.Pipewire
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
property bool ready: Pipewire.ready
|
property bool ready: Pipewire.ready
|
||||||
property bool muted: defaultAudio.audio.muted
|
property bool muted: ready ? defaultAudio.audio.muted : true
|
||||||
property PwNode defaultAudio: Pipewire.defaultAudioSink
|
property PwNode defaultAudio: Pipewire.defaultAudioSink
|
||||||
property PwNode preferredAudio: Pipewire.preferredDefaultAudioSink
|
property PwNode preferredAudio: Pipewire.preferredDefaultAudioSink
|
||||||
property real percentage: Math.round(preferredAudio?.audio.volume * 100)
|
property real percentage: Math.round(preferredAudio?.audio.volume * 100)
|
||||||
|
|
@ -16,8 +16,8 @@ Singleton {
|
||||||
objects: [...root.sinks, ...root.sources]
|
objects: [...root.sinks, ...root.sources]
|
||||||
}
|
}
|
||||||
function getVolumeIcon(sink) {
|
function getVolumeIcon(sink) {
|
||||||
let mute = sink.audio.muted
|
let mute = root.ready ? sink.audio.muted : true;
|
||||||
let volume = sink.audio.volume
|
let volume = root.ready ? sink.audio.volume : 0;
|
||||||
if (mute) {
|
if (mute) {
|
||||||
return "audio-volume-muted-symbolic";
|
return "audio-volume-muted-symbolic";
|
||||||
}
|
}
|
||||||
|
|
@ -31,4 +31,7 @@ Singleton {
|
||||||
return "audio-volume-high-symbolic";
|
return "audio-volume-high-symbolic";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function setDefaultSink(node: PwNode): void {
|
||||||
|
Pipewire.preferredDefaultAudioSink = node;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,11 @@ PopupWindow {
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: audioLayout
|
id: audioLayout
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 12
|
anchors.centerIn: parent
|
||||||
|
anchors.margins: 10
|
||||||
spacing: 8
|
spacing: 8
|
||||||
Repeater {
|
Repeater {
|
||||||
|
|
||||||
model: Audio.sinks
|
model: Audio.sinks
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
id: audioDelContainer
|
id: audioDelContainer
|
||||||
|
|
@ -81,7 +83,7 @@ PopupWindow {
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Audio.preferredAudio = audioDelContainer.modelData
|
Audio.setDefaultSink(audioDelContainer.modelData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,4 @@ primaryMon=eDP-1
|
||||||
rounding=16
|
rounding=16
|
||||||
showCorners=true
|
showCorners=true
|
||||||
wallDir=file:///home/lucy/.walls
|
wallDir=file:///home/lucy/.walls
|
||||||
wallpaper=@Variant(\0\0\0\x11\0\0\0!/home/lucy/.walls/frierensuff.png)
|
wallpaper=@Variant(\0\0\0\x11\0\0\0\x1b/home/lucy/.walls/faris.png)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue