Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions qml/panels/Panel.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick
import QtQuick 6.11
import QtQuick.Controls
import Quickshell
import Quickshell.Io
Expand Down Expand Up @@ -860,10 +860,26 @@ Panel {


function setDefaultDevice(node, previous, direction) {
if (!mutableAudioNode(node) || sceneController.busy || routeMutationBusy) return false
var fail = direction === "output"
? function(message) { defaultOutputError = message }
: function(message) { defaultInputError = message }
if (!mutableAudioNode(node)) {
fail("That device just changed; wait a moment and retry")
return false
}
if (sceneController.busy || routeMutationBusy) {
fail("Audio is applying another change; retry in a moment")
return false
}
var identity = audioService.identityForNode(node)
var previousIdentity = audioService.identityForNode(previous)
if (!identity || (previous && !previousIdentity)) return false
if (!identity) {
fail("Device snapshot is stale; wait a moment and retry")
return false
}
// A previous default that already left the graph cannot be resolved here.
// The backend recomputes it from routing state, so a stale previous must
// never block the whole switch.
var previousIdentity = previous ? audioService.identityForNode(previous) : null
if (direction === "output") defaultOutputError = ""
else defaultInputError = ""
defaultSetPending = true
Expand Down Expand Up @@ -1427,7 +1443,7 @@ Panel {
preferredName: root.preferredOutputName
label: root.nodeLabel(sinkDelegate.node)
outputGroup: Model.isOutputGroupSink(sinkDelegate.node)
defaultSetBusy: root.sceneMutationBusy
defaultSetBusy: root.sceneController.busy || root.defaultSetPending
hasCursor: root.cursorActive && root.focusSection === "output"
&& root.selectedIndex === sinkDelegate.rowIndex
onHasCursorChanged: if (hasCursor) root.ensureCursorVisible(sinkDelegate)
Expand Down Expand Up @@ -1564,7 +1580,7 @@ Panel {
bar: root.bar
preferredName: root.preferredInputName
label: root.nodeLabel(sourceDelegate.node)
defaultSetBusy: root.sceneMutationBusy
defaultSetBusy: root.sceneController.busy || root.defaultSetPending
hasCursor: root.cursorActive && root.focusSection === "input"
&& root.selectedIndex === sourceDelegate.rowIndex
onHasCursorChanged: if (hasCursor) root.ensureCursorVisible(sourceDelegate)
Expand Down
Loading