fix(main): 在wayland环境下使用WAYLAND_DISPLAY生成appid
This commit is contained in:
parent
8bcf44ba07
commit
64035e88dc
10
src/main.cpp
10
src/main.cpp
|
@ -6,6 +6,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
#include <KWindowSystem>
|
||||||
|
|
||||||
#include "qtsingleapplication.h"
|
#include "qtsingleapplication.h"
|
||||||
#include "ukui-menu-application.h"
|
#include "ukui-menu-application.h"
|
||||||
|
@ -138,8 +139,15 @@ int main(int argc, char *argv[])
|
||||||
QCoreApplication::setOrganizationDomain("ukui.org");
|
QCoreApplication::setOrganizationDomain("ukui.org");
|
||||||
QCoreApplication::setApplicationVersion("0.0.1-alpha");
|
QCoreApplication::setApplicationVersion("0.0.1-alpha");
|
||||||
|
|
||||||
QString appid = QString("ukui-menu-%1").arg(QLatin1String(getenv("DISPLAY")));
|
QString display;
|
||||||
|
if (KWindowSystem::isPlatformWayland()) {
|
||||||
|
display = QLatin1String(getenv("WAYLAND_DISPLAY"));
|
||||||
|
} else {
|
||||||
|
display = QLatin1String(getenv("DISPLAY"));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString appid = QString("ukui-menu-%1").arg(display);
|
||||||
|
qDebug() << "ukui-menu launch with:" << display << "appid:" << appid;
|
||||||
QtSingleApplication app(appid, argc, argv);
|
QtSingleApplication app(appid, argc, argv);
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
|
|
Loading…
Reference in New Issue