feat(app): 不支持传送门的环境只提示一次并保持待命
- --daemon 启动时检测 org.gxde.Portal,缺失则发一次桌面通知 - 记录 warned/unsupportedEnv,避免 gxde-k9 反复拉起时重复提示
This commit is contained in:
Vendored
+3
@@ -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=
|
||||
+22
@@ -11,6 +11,8 @@
|
||||
#include "todo/todowindow.h"
|
||||
#include "ui/portalpanel.h"
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QLocalServer>
|
||||
#include <QTimer>
|
||||
#include <QLocalSocket>
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user