// Which applications are listening right now, and a way to shut each of them // up without hunting through their own preferences. // // The row is absent rather than empty when nothing is listening: "no // applications are using the microphone" is a sentence nobody needs to read on // a page they opened to change an output device. import QtQuick import Quickshell.Services.Pipewire import qs.config import qs.modules.quicksettings import qs.services SettingRow { id: root readonly property var users: AudioDevices.captureApplications ?? [] label: "Using the microphone" detail: "Applications listening right now" // A Column skips invisible children, so an empty row costs no space. visible: root.users.length > 0 controlWidth: Math.max(120, chips.implicitWidth + 8) // Mute state is audio state: untracked nodes report false and swallow the // write that would have muted them. PwObjectTracker { objects: root.users.reduce((all, application) => all.concat(application?.nodes ?? []), []) } Row { id: chips anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter spacing: 8 Repeater { model: root.users Rectangle { id: chip required property var modelData readonly property bool muted: AudioDevices.applicationMuted(chip.modelData) implicitWidth: name.implicitWidth + muteButton.width + 20 implicitHeight: 26 radius: Theme.pillRadius color: Theme.alpha(Theme.fg, 0.06) border.width: 1 border.color: Theme.alpha(Theme.fg, 0.08) Text { id: name anchors.left: parent.left anchors.leftMargin: 11 anchors.verticalCenter: parent.verticalCenter text: String(chip.modelData?.label ?? "") color: chip.muted ? Theme.fgMuted : Theme.fg font.family: Theme.fontFamily font.pixelSize: Theme.fontSizeSmall } IconButton { id: muteButton anchors.right: parent.right anchors.rightMargin: 2 anchors.verticalCenter: parent.verticalCenter size: 24 iconSize: 14 icon: chip.muted ? "microphone-sensitivity-muted-symbolic" : "audio-input-microphone-symbolic" iconFallback: "audio-input-microphone-symbolic" tint: chip.muted ? Theme.danger : Theme.fgDim onClicked: AudioDevices.setApplicationMuted(chip.modelData, !chip.muted) } } } } }