From d69326bc6f15c7de54978acdc3e95b50b6736831 Mon Sep 17 00:00:00 2001 From: shenmo Date: Fri, 30 Oct 2026 20:17:25 +0800 Subject: [PATCH] =?UTF-8?q?feat(app):=20=E4=B8=8D=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=BC=A0=E9=80=81=E9=97=A8=E7=9A=84=E7=8E=AF=E5=A2=83=E5=8F=AA?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=B8=80=E6=AC=A1=E5=B9=B6=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E5=BE=85=E5=91=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - --daemon 启动时检测 org.gxde.Portal,缺失则发一次桌面通知 - 记录 warned/unsupportedEnv,避免 gxde-k9 反复拉起时重复提示 --- debian/gxde-ai-see.substvars | 3 +++ src/app.cpp | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 debian/gxde-ai-see.substvars diff --git a/debian/gxde-ai-see.substvars b/debian/gxde-ai-see.substvars new file mode 100644 index 0000000..910ebe4 --- /dev/null +++ b/debian/gxde-ai-see.substvars @@ -0,0 +1,3 @@ +shlibs:Depends=libc6 (>= 2.34), libdtk2widget6 (>= 6:6.3.8), libdtk6core (>= 6.0.48), libgcc-s1 (>= 3.0), libicu76 (>= 76.1-1~), liblayershellqtinterface6 (>= 6.1.0), libqt6core6t64 (>= 6.8.2), libqt6dbus6 (>= 6.1.2), libqt6gui6 (>= 6.1.2), libqt6network6 (>= 6.1.2), libqt6widgets6 (>= 6.3.0), libstdc++6 (>= 5) +misc:Depends= +misc:Pre-Depends= diff --git a/src/app.cpp b/src/app.cpp index dc14e18..b234078 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -11,6 +11,8 @@ #include "todo/todowindow.h" #include "ui/portalpanel.h" +#include +#include #include #include #include @@ -60,6 +62,26 @@ bool App::init(bool daemon, bool forceShow, bool showTodo, bool showChat) m_model = new StagingModel(this); + /* gxde-k9 keeps restarting us; when the compositor has no portal support we + * warn once and then stay idle instead of exiting (which would make k9 + * relaunch us every few seconds). */ + if (daemon && !PortalClient::instance()->available() && + !Config::instance()->getBool(QStringLiteral("warned/unsupportedEnv"), false)) { + QDBusMessage notification = QDBusMessage::createMethodCall( + QStringLiteral("org.freedesktop.Notifications"), + QStringLiteral("/org/freedesktop/Notifications"), + QStringLiteral("org.freedesktop.Notifications"), QStringLiteral("Notify")); + notification << QStringLiteral("gxde-ai-see") << 0u + << QStringLiteral("gxde-ai-see") + << tr("小埃同学") + << tr("当前桌面不支持传送门(需要 GXDE Wayland 合成器)。" + "小埃同学会继续在后台待命,暂存区、内容工厂和对话仍然可用。") + << QStringList() << QVariantMap() << 6000; + QDBusConnection::sessionBus().send(notification); + Config::instance()->set(QStringLiteral("warned/unsupportedEnv"), true); + Config::instance()->sync(); + } + PortalClient *portal = PortalClient::instance(); connect(portal, &PortalClient::dragStarted, this, [this](const QString &mimeTypes) { if (!PortalClient::mimeInteresting(mimeTypes)) {