From 64035e88dc55091fdc986e42a32a403cf8eaa700 Mon Sep 17 00:00:00 2001 From: hewenfei Date: Fri, 8 Sep 2023 16:06:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(main):=20=E5=9C=A8wayland=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=B8=8B=E4=BD=BF=E7=94=A8WAYLAND=5FDISPLAY=E7=94=9F=E6=88=90a?= =?UTF-8?q?ppid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 5ef597c..59453ae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "qtsingleapplication.h" #include "ukui-menu-application.h" @@ -138,8 +139,15 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationDomain("ukui.org"); 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); QTranslator translator;