Commit 378309e6 authored by David Redondo's avatar David Redondo 🏎

Set a desktopName when restoring applications

Allows us to properly add info for the taskmanager and the job for example
allowing it to place it in a cgroup with a proper name.
parent 97f4599a
......@@ -84,7 +84,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <kprocess.h>
#include <kshell.h>
#include <KApplicationTrader>
#include <KIO/CommandLauncherJob>
#include <KIO/DesktopExecParser>
#include <KService>
#include <KScreenLocker/KsldApp>
......@@ -132,6 +135,13 @@ void KSMServer::startApplication( const QStringList& cmd, const QString& clientM
const QString app = command.takeFirst();
const QStringList argList = command;
auto *job = new KIO::CommandLauncherJob(app, argList);
auto apps = KApplicationTrader::query([&app] (const KService::Ptr service) {
const QString binary = KIO::DesktopExecParser::executablePath(service->exec());
return !binary.isEmpty() && app.endsWith(binary);
});
if (!apps.empty()) {
job->setDesktopName(apps[0]->desktopEntryName());
}
job->start();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment