Use abstract socket for single instance on Linux

This commit is contained in:
Ilya Fedin 2023-03-31 21:21:12 +04:00 committed by John Preston
parent bebf8e4a03
commit 30f057fff5
2 changed files with 11 additions and 0 deletions

View File

@ -122,6 +122,10 @@ int Sandbox::start() {
}
}
#ifdef Q_OS_LINUX
_localServer.setSocketOptions(QLocalServer::AbstractNamespaceOption);
#endif
connect(
&_localSocket,
&QLocalSocket::connected,

View File

@ -557,7 +557,14 @@ void SetApplicationIcon(const QIcon &icon) {
}
QString SingleInstanceLocalServerName(const QString &hash) {
#ifdef Q_OS_LINUX
if (KSandbox::isSnap()) {
return u"snap.telegram-desktop."_q + hash;
}
return hash + '-' + cGUIDStr();
#else // Q_OS_LINUX
return QDir::tempPath() + '/' + hash + '-' + cGUIDStr();
#endif // !Q_OS_LINUX
}
std::optional<bool> IsDarkMode() {