services/pipewire: ignore monitors in PwNodeLinkTracker
Some checks failed
Build / Nix (push) Has been cancelled
Build / Nix-1 (push) Has been cancelled
Build / Nix-2 (push) Has been cancelled
Build / Nix-3 (push) Has been cancelled
Build / Nix-4 (push) Has been cancelled
Build / Nix-5 (push) Has been cancelled
Build / Nix-6 (push) Has been cancelled
Build / Nix-7 (push) Has been cancelled
Build / Nix-8 (push) Has been cancelled
Build / Nix-9 (push) Has been cancelled
Build / Nix-10 (push) Has been cancelled
Build / Nix-11 (push) Has been cancelled
Build / Nix-12 (push) Has been cancelled
Build / Nix-13 (push) Has been cancelled
Build / Nix-14 (push) Has been cancelled
Build / Nix-15 (push) Has been cancelled
Build / Nix-16 (push) Has been cancelled
Build / Nix-17 (push) Has been cancelled
Build / Nix-18 (push) Has been cancelled
Build / Nix-19 (push) Has been cancelled
Build / Nix-20 (push) Has been cancelled
Build / Nix-21 (push) Has been cancelled
Build / Nix-22 (push) Has been cancelled
Build / Nix-23 (push) Has been cancelled
Build / Nix-24 (push) Has been cancelled
Build / Nix-25 (push) Has been cancelled
Build / Nix-26 (push) Has been cancelled
Build / Nix-27 (push) Has been cancelled
Build / Nix-28 (push) Has been cancelled
Build / Nix-29 (push) Has been cancelled
Build / Nix-30 (push) Has been cancelled
Build / Nix-31 (push) Has been cancelled
Build / Archlinux (push) Has been cancelled
Lint / Lint (push) Has been cancelled

This commit is contained in:
outfoxxed 2026-01-09 00:58:30 -08:00
parent 11d6d67961
commit eecc2f88b3
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
5 changed files with 14 additions and 3 deletions

View file

@ -25,6 +25,7 @@ set shell id.
- FreeBSD is now partially supported. - FreeBSD is now partially supported.
- IPC operations filter available instances to the current display connection by default. - IPC operations filter available instances to the current display connection by default.
- PwNodeLinkTracker ignores sound level monitoring programs.
## Bug Fixes ## Bug Fixes

View file

@ -164,6 +164,12 @@ void PwNode::initProps(const spa_dict* props) {
this->nick = nodeNick; this->nick = nodeNick;
} }
if (const auto* nodeCategory = spa_dict_lookup(props, PW_KEY_MEDIA_CATEGORY)) {
if (strcmp(nodeCategory, "Monitor") == 0 || strcmp(nodeCategory, "Manager") == 0) {
this->isMonitor = true;
}
}
if (const auto* serial = spa_dict_lookup(props, PW_KEY_OBJECT_SERIAL)) { if (const auto* serial = spa_dict_lookup(props, PW_KEY_OBJECT_SERIAL)) {
auto ok = false; auto ok = false;
auto value = QString::fromUtf8(serial).toULongLong(&ok); auto value = QString::fromUtf8(serial).toULongLong(&ok);

View file

@ -236,6 +236,7 @@ public:
QString nick; QString nick;
QMap<QString, QString> properties; QMap<QString, QString> properties;
quint64 objectSerial = 0; quint64 objectSerial = 0;
bool isMonitor = false;
PwNodeType::Flags type = PwNodeType::Untracked; PwNodeType::Flags type = PwNodeType::Untracked;

View file

@ -213,6 +213,7 @@ void PwNodeLinkTracker::updateLinks() {
|| (this->mNode->isSink() && link->inputNode() == this->mNode->id())) || (this->mNode->isSink() && link->inputNode() == this->mNode->id()))
{ {
auto* iface = PwLinkGroupIface::instance(link); auto* iface = PwLinkGroupIface::instance(link);
if (iface->target()->node()->isMonitor) return;
// do not connect twice // do not connect twice
if (!this->mLinkGroups.contains(iface)) { if (!this->mLinkGroups.contains(iface)) {
@ -231,7 +232,7 @@ void PwNodeLinkTracker::updateLinks() {
for (auto* iface: this->mLinkGroups) { for (auto* iface: this->mLinkGroups) {
// only disconnect no longer used nodes // only disconnect no longer used nodes
if (!newLinks.contains(iface)) { if (!newLinks.contains(iface) || iface->target()->node()->isMonitor) {
QObject::disconnect(iface, nullptr, this, nullptr); QObject::disconnect(iface, nullptr, this, nullptr);
} }
} }
@ -271,6 +272,8 @@ void PwNodeLinkTracker::onLinkGroupCreated(PwLinkGroup* linkGroup) {
|| (this->mNode->isSink() && linkGroup->inputNode() == this->mNode->id())) || (this->mNode->isSink() && linkGroup->inputNode() == this->mNode->id()))
{ {
auto* iface = PwLinkGroupIface::instance(linkGroup); auto* iface = PwLinkGroupIface::instance(linkGroup);
if (iface->target()->node()->isMonitor) return;
QObject::connect(iface, &QObject::destroyed, this, &PwNodeLinkTracker::onLinkGroupDestroyed); QObject::connect(iface, &QObject::destroyed, this, &PwNodeLinkTracker::onLinkGroupDestroyed);
this->mLinkGroups.push_back(iface); this->mLinkGroups.push_back(iface);
emit this->linkGroupsChanged(); emit this->linkGroupsChanged();

View file

@ -171,13 +171,13 @@ private:
ObjectModel<PwLinkGroupIface> mLinkGroups {this}; ObjectModel<PwLinkGroupIface> mLinkGroups {this};
}; };
///! Tracks all link connections to a given node. ///! Tracks non-monitor link connections to a given node.
class PwNodeLinkTracker: public QObject { class PwNodeLinkTracker: public QObject {
Q_OBJECT; Q_OBJECT;
// clang-format off // clang-format off
/// The node to track connections to. /// The node to track connections to.
Q_PROPERTY(qs::service::pipewire::PwNodeIface* node READ node WRITE setNode NOTIFY nodeChanged); Q_PROPERTY(qs::service::pipewire::PwNodeIface* node READ node WRITE setNode NOTIFY nodeChanged);
/// Link groups connected to the given node. /// Link groups connected to the given node, excluding monitors.
/// ///
/// If the node is a sink, links which target the node will be tracked. /// If the node is a sink, links which target the node will be tracked.
/// If the node is a source, links which source the node will be tracked. /// If the node is a source, links which source the node will be tracked.