* feat: basic audio switcher * feat: replace VerticalSlider with StyledSlider * fix: styling * fix: formatting * chore: make sound icons consistent, change slider styling * feat: styled slider component variants * chore: cleanup * chore: cleanup * fix: pr fixes * fix: remove redundant code * chore: remove old code * fix: controls styling * fixes * more tweaks * radiobtn: add interaction stuff Anim slider --------- Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
44 lines
1.2 KiB
QML
44 lines
1.2 KiB
QML
pragma Singleton
|
|
|
|
import Quickshell
|
|
import Quickshell.Services.Pipewire
|
|
|
|
Singleton {
|
|
id: root
|
|
|
|
readonly property var nodes: Pipewire.nodes.values.reduce((acc, node) => {
|
|
if (!node.isStream) {
|
|
if (node.isSink) acc.sinks.push(node)
|
|
else if (node.audio) acc.sources.push(node)
|
|
}
|
|
return acc
|
|
}, { sources: [], sinks: [] })
|
|
|
|
readonly property list<PwNode> sinks: nodes.sinks
|
|
readonly property list<PwNode> sources: nodes.sources
|
|
|
|
readonly property PwNode sink: Pipewire.defaultAudioSink
|
|
readonly property PwNode source: Pipewire.defaultAudioSource
|
|
|
|
readonly property bool muted: !!sink?.audio?.muted
|
|
readonly property real volume: sink?.audio?.volume ?? 0
|
|
|
|
function setVolume(newVolume: real): void {
|
|
if (sink?.ready && sink?.audio) {
|
|
sink.audio.muted = false;
|
|
sink.audio.volume = newVolume;
|
|
}
|
|
}
|
|
|
|
function setAudioSink(newSink: PwNode): void {
|
|
Pipewire.preferredDefaultAudioSink = newSink
|
|
}
|
|
|
|
function setAudioSource(newSource: PwNode): void {
|
|
Pipewire.preferredDefaultAudioSource = newSource
|
|
}
|
|
|
|
PwObjectTracker {
|
|
objects: [...root.sinks, ...root.sources]
|
|
}
|
|
}
|