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>
This commit is contained in:
Robin Seger 2026-03-27 08:47:05 +01:00 committed by GitHub
parent 148417baa1
commit 49695f8fd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,6 +2,7 @@ pragma Singleton
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Io
import Quickshell.Services.Pipewire import Quickshell.Services.Pipewire
import Caelestia import Caelestia
import Caelestia.Services import Caelestia.Services
@ -67,6 +68,15 @@ Singleton {
Pipewire.preferredDefaultAudioSource = newSource; 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 { function setStreamVolume(stream: PwNode, newVolume: real): void {
if (stream?.ready && stream?.audio) { if (stream?.ready && stream?.audio) {
stream.audio.muted = false; stream.audio.muted = false;
@ -162,4 +172,12 @@ Singleton {
BeatTracker { BeatTracker {
id: beatTracker id: beatTracker
} }
IpcHandler {
function cycleOutput(): void {
root.cycleNextAudioOutput();
}
target: "audio"
}
} }