fix usage of application.process.binary

This commit is contained in:
Malte Jürgens 2023-01-26 01:19:38 +01:00
parent 2a809e163e
commit a10cfda56d
No known key found for this signature in database
GPG key ID: D29FBD5F93C0CFC3

View file

@ -23,7 +23,8 @@ QVector<QString> getTargets() {
auto node = reg.bind<pipewire::node>(global.id); auto node = reg.bind<pipewire::node>(global.id);
auto info = node.info(); auto info = node.info();
QString name; QString name;
if (info.props.count("application.name")) if (info.props.count("application.name") &&
info.props["application.name"] != "")
name = QString::fromStdString(info.props["application.name"]); name = QString::fromStdString(info.props["application.name"]);
else else
name = QString::fromStdString( name = QString::fromStdString(
@ -73,7 +74,8 @@ void start(QString _target) {
auto &parent = nodes.at(parent_id); auto &parent = nodes.at(parent_id);
std::string name; std::string name;
if (parent.props.count("application.name")) if (parent.props.count("application.name") &&
parent.props["application.name"] != "")
name = parent.props["application.name"]; name = parent.props["application.name"];
else else
name = parent.props["application.process.binary"]; name = parent.props["application.process.binary"];
@ -122,11 +124,12 @@ void start(QString _target) {
auto node = reg.bind<pipewire::node>(global.id); auto node = reg.bind<pipewire::node>(global.id);
auto info = node.info(); auto info = node.info();
std::string name; std::string name;
if (info.props.count("application.name")) if (info.props.count("application.name") &&
info.props["application.name"] != "")
name = info.props["application.name"]; name = info.props["application.name"];
else if (info.props.count("application.process.binary")) else if (info.props.count("application.process.binary")) {
name = info.props["application.process.binary"]; name = info.props["application.process.binary"];
else } else
return; return;
qDebug(virtmicLog) << QString("Added: %1") qDebug(virtmicLog) << QString("Added: %1")
.arg(QString::fromStdString(name)) .arg(QString::fromStdString(name))
@ -166,7 +169,8 @@ void start(QString _target) {
if (nodes.count(id)) { if (nodes.count(id)) {
auto info = nodes.at(id); auto info = nodes.at(id);
std::string name; std::string name;
if (info.props.count("application.name")) if (info.props.count("application.name") &&
info.props["application.name"] != "")
name = info.props["application.name"]; name = info.props["application.name"];
else else
name = info.props["application.process.binary"]; name = info.props["application.process.binary"];