Restore following XDG_SESSION_ID env if set
BUG: 435468 Testing done: Ran on a VT with an XDG_SESSION_ID from another terminal, ensured it switched
This commit is contained in:
parent
c103eb8f5c
commit
799db61381
1 changed files with 13 additions and 5 deletions
|
@ -61,11 +61,19 @@ static const QString s_managerPath = QStringLiteral("/org/freedesktop/login1");
|
|||
|
||||
static QString findProcessSessionPath()
|
||||
{
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(s_serviceName, s_managerPath,
|
||||
s_managerInterface,
|
||||
QStringLiteral("GetSessionByPID"));
|
||||
message.setArguments({ uint32_t(QCoreApplication::applicationPid()) });
|
||||
|
||||
const QString sessionId = qEnvironmentVariable("XDG_SESSION_ID");
|
||||
QDBusMessage message;
|
||||
if (sessionId.isEmpty()) {
|
||||
message = QDBusMessage::createMethodCall(s_serviceName, s_managerPath,
|
||||
s_managerInterface,
|
||||
QStringLiteral("GetSessionByPID"));
|
||||
message.setArguments({uint32_t(QCoreApplication::applicationPid())});
|
||||
} else {
|
||||
message = QDBusMessage::createMethodCall(s_serviceName, s_managerPath,
|
||||
s_managerInterface,
|
||||
QStringLiteral("GetSession"));
|
||||
message.setArguments({sessionId});
|
||||
}
|
||||
const QDBusMessage reply = QDBusConnection::systemBus().call(message);
|
||||
if (reply.type() == QDBusMessage::ErrorMessage) {
|
||||
return QString();
|
||||
|
|
Loading…
Reference in a new issue