From 49695f8fd0163041e125c7ac72d0c9740676e9fa Mon Sep 17 00:00:00 2001 From: Robin Seger Date: Fri, 27 Mar 2026 08:47:05 +0100 Subject: [PATCH] audio: add default output sink cycle ipc (#1200) * [CI] chore: update flake * [CI] chore: update flake * [CI] chore: update flake * [CI] chore: update flake * audio: added default audio output cycle IPC * fix format --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> --- services/Audio.qml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/services/Audio.qml b/services/Audio.qml index 100f0010..e2d936a0 100644 --- a/services/Audio.qml +++ b/services/Audio.qml @@ -2,6 +2,7 @@ pragma Singleton import QtQuick import Quickshell +import Quickshell.Io import Quickshell.Services.Pipewire import Caelestia import Caelestia.Services @@ -67,6 +68,15 @@ Singleton { Pipewire.preferredDefaultAudioSource = newSource; } + function cycleNextAudioOutput(): void { + if (sinks.length === 0) + return; + + const currentIndex = sinks.findIndex(s => s === sink); + const nextIndex = (currentIndex + 1) % sinks.length; + setAudioSink(sinks[nextIndex]); + } + function setStreamVolume(stream: PwNode, newVolume: real): void { if (stream?.ready && stream?.audio) { stream.audio.muted = false; @@ -162,4 +172,12 @@ Singleton { BeatTracker { id: beatTracker } + + IpcHandler { + function cycleOutput(): void { + root.cycleNextAudioOutput(); + } + + target: "audio" + } }