pragma ComponentBehavior: Bound import QtQuick import QtQuick.Layouts import ".." import "../../components" import "../../services" import "../../theme" // Output and microphone levels; the chevron reveals device selection. ControlCard { id: root property bool detailed: false property bool expanded: detailed RowLayout { Layout.fillWidth: true Text { text: "Sound" color: Theme.text font.pixelSize: 13 font.weight: Font.DemiBold Layout.fillWidth: true } Rectangle { objectName: "audioDevices" visible: !root.detailed && AudioService.available implicitWidth: 24 implicitHeight: 24 radius: 12 color: chevron.containsMouse ? Qt.alpha(Theme.text, 0.12) : Theme.transparent Accessible.name: root.expanded ? "Hide audio devices" : "Show audio devices" Accessible.role: Accessible.Button Text { anchors.centerIn: parent text: "›" color: Theme.textSecondary font.pixelSize: 18 rotation: root.expanded ? 90 : 0 Behavior on rotation { NumberAnimation { duration: Theme.duration easing.type: Easing.OutCubic } } } MouseArea { id: chevron anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: root.expanded = !root.expanded } } } Repeater { model: [false, true] RowLayout { id: channel required property bool modelData readonly property var node: modelData ? AudioService.source : AudioService.sink readonly property bool muted: !!node && !!node.audio && node.audio.muted Layout.fillWidth: true spacing: 10 CCToggle { objectName: channel.modelData ? "microphoneMute" : "volumeMute" size: 28 glyph: channel.modelData ? (channel.muted ? "󰍭" : "󰍬") : (channel.muted ? "󰖁" : "󰕾") fallback: channel.muted ? "×" : (channel.modelData ? "M" : "♪") checked: channel.muted enabled: !!channel.node && !!channel.node.audio onClicked: AudioService.mute(channel.modelData) Accessible.name: channel.modelData ? "Mute microphone" : "Mute output" } GlassBarSlider { objectName: channel.modelData ? "microphoneSlider" : "volumeSlider" Layout.fillWidth: true from: 0 to: 1 stepSize: 0.01 enabled: !!channel.node && !!channel.node.audio value: channel.node && channel.node.audio ? channel.node.audio.volume : 0 onMoved: AudioService.volume(channel.modelData, value) Accessible.name: channel.modelData ? "Microphone level" : "Output volume" } Text { text: channel.node && channel.node.audio ? Math.round(channel.node.audio.volume * 100) + "%" : "—" color: Theme.textSecondary font.pixelSize: 11 horizontalAlignment: Text.AlignRight Layout.preferredWidth: 34 } } } Repeater { model: root.expanded ? [false, true] : [] ColumnLayout { id: devices required property bool modelData readonly property var nodes: modelData ? AudioService.inputs : AudioService.outputs readonly property var current: modelData ? AudioService.source : AudioService.sink Layout.fillWidth: true spacing: 2 Text { text: devices.modelData ? "INPUT" : "OUTPUT" color: Theme.textSecondary font.pixelSize: 10 font.weight: Font.DemiBold font.letterSpacing: 1.1 Layout.topMargin: 4 } Repeater { model: devices.nodes Rectangle { id: device required property var modelData required property int index readonly property bool selected: modelData === devices.current Layout.fillWidth: true implicitHeight: 30 radius: 8 color: deviceArea.containsMouse ? Qt.alpha(Theme.text, 0.08) : Theme.transparent RowLayout { anchors.fill: parent anchors.leftMargin: 6 anchors.rightMargin: 6 spacing: 8 Text { text: device.selected ? "✓" : "" color: Theme.accent font.pixelSize: 12 Layout.preferredWidth: 14 } Text { text: device.modelData.description || device.modelData.name color: device.selected ? Theme.text : Qt.alpha(Theme.text, 0.8) font.pixelSize: 12 font.weight: device.selected ? Font.DemiBold : Font.Normal elide: Text.ElideRight Layout.fillWidth: true } } MouseArea { id: deviceArea anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: AudioService.select(devices.modelData, device.index) } } } } } Text { visible: !AudioService.available text: "PipeWire is unavailable" color: Theme.textSecondary font.pixelSize: 11 } }