Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions apps/app-launch-helper/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ int processKVPair(msg_ptr msg, std::unordered_map<std::string, std::vector<std::
std::optional<std::string> cmdParse(msg_ptr &msg, const std::vector<std::string_view> &cmdLines)
{
std::string unitName;
std::string syslogIdentifier;
std::unordered_map<std::string, std::vector<std::string>> props;

size_t cursor{0};
Expand Down Expand Up @@ -311,6 +312,11 @@ std::optional<std::string> cmdParse(msg_ptr &msg, const std::vector<std::string_
continue;
}

if (key == "SyslogIdentifier") {
syslogIdentifier = value;
continue;
}

if (key == "ExecSearchPath") {
const std::filesystem::path path{value};

Expand Down Expand Up @@ -363,6 +369,18 @@ std::optional<std::string> cmdParse(msg_ptr &msg, const std::vector<std::string_
return std::nullopt;
}

if (!syslogIdentifier.empty()) {
if (ret = sd_bus_message_append(msg,
"(sv)",
"SyslogIdentifier",
"s",
syslogIdentifier.c_str());
ret < 0) {
sd_journal_perror("failed to append SyslogIdentifier property.");
return std::nullopt;
}
}

if (ret = processKVPair(msg, props); ret < 0) { // process props
return std::nullopt;
}
Expand Down
3 changes: 2 additions & 1 deletion src/dbus/applicationservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,11 @@ ApplicationService::Launch(const QString &action, const QStringList &fields, con
const auto objectPath = m_applicationPath.path() + "/" + instanceRandomUUID;

QStringList newCommands;
const int estimatedSize = 5 + cmds.size() + task.command.size() + (value.isValid() ? 1 : 0);
const int estimatedSize = 6 + cmds.size() + task.command.size() + (value.isValid() ? 1 : 0);
newCommands.reserve(estimatedSize);
newCommands
<< QStringLiteral("--unitName=app-DDE-%1@%2.service").arg(escapeApplicationId(this->id()), instanceRandomUUID);
newCommands << QStringLiteral("--SyslogIdentifier=%1").arg(this->id());
newCommands << QStringLiteral("--SourcePath=%1").arg(m_desktopSource.sourcePath());
newCommands << std::move(cmds);

Expand Down