diff options
| author | Laurens Duin <85798751+Laurens256@users.noreply.github.com> | 2025-08-05 08:04:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-05 16:04:53 +1000 |
| commit | 9ada66a78ea58d8b498f1dd26bf0783e1a442c51 (patch) | |
| tree | 60963034cc340b64cf25a63b3ce43483f5eb8d63 /services | |
| parent | launcher: allow wallpaper switch when exactly 2 wallpapers (#343) (diff) | |
| download | caelestia-shell-9ada66a78ea58d8b498f1dd26bf0783e1a442c51.tar.gz caelestia-shell-9ada66a78ea58d8b498f1dd26bf0783e1a442c51.tar.bz2 caelestia-shell-9ada66a78ea58d8b498f1dd26bf0783e1a442c51.zip | |
bar/popouts: add audio device switcher (#319)
* 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>
Diffstat (limited to 'services')
| -rw-r--r-- | services/Audio.qml | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/services/Audio.qml b/services/Audio.qml index c91adbc..54cea3b 100644 --- a/services/Audio.qml +++ b/services/Audio.qml @@ -6,20 +6,39 @@ 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 ?? false + readonly property bool muted: !!sink?.audio?.muted readonly property real volume: sink?.audio?.volume ?? 0 - function setVolume(volume: real): void { + function setVolume(newVolume: real): void { if (sink?.ready && sink?.audio) { sink.audio.muted = false; - sink.audio.volume = volume; + sink.audio.volume = newVolume; } } + function setAudioSink(newSink: PwNode): void { + Pipewire.preferredDefaultAudioSink = newSink + } + + function setAudioSource(newSource: PwNode): void { + Pipewire.preferredDefaultAudioSource = newSource + } + PwObjectTracker { - objects: [Pipewire.defaultAudioSink, Pipewire.defaultAudioSource] + objects: [...root.sinks, ...root.sources] } } |