From 68dc75916ace518662717affd3bd0b41c5be8551 Mon Sep 17 00:00:00 2001 From: rewine Date: Thu, 5 Feb 2026 16:15:56 +0800 Subject: [PATCH] fix: suppress splash for singleton apps with existing instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The change modifies the splash screen logic to skip showing the splash screen for singleton applications that already have running instances. Previously, splash screens were only suppressed for system autostart launches. Now, when a singleton application (marked with X-Deepin- Singleton=true) is launched while another instance is already running, the splash screen will be skipped to prevent redundant visual feedback. Technical details: 1. Added detection for singleton applications using the X-Deepin- Singleton desktop entry key 2. Added check for existing application instances using m_Instances.isEmpty() 3. Combined both conditions to determine when to skip splash screen 4. Added appropriate logging for the new skip condition Log: Skip splash screen when launching singleton applications with existing instances Influence: 1. Test launching singleton applications when no instance is running - should show splash 2. Test launching singleton applications when instance is already running - should skip splash 3. Verify system autostart launches still skip splash as before 4. Test non-singleton applications behavior remains unchanged 5. Check logging output for proper splash skip messages fix: 为已有实例的单例应用跳过启动闪屏 修改了启动闪屏逻辑,对于已有运行实例的单例应用跳过显示启动闪屏。之前 仅对系统自启动的应用程序跳过闪屏显示。现在当单例应用(标记为X-Deepin- Singleton=true)在已有实例运行时再次启动,将跳过闪屏以避免冗余的视觉 反馈。 技术细节: 1. 添加了对单例应用的检测,使用X-Deepin-Singleton桌面条目键 2. 添加了对现有应用实例的检查,使用m_Instances.isEmpty() 3. 结合两个条件来确定何时跳过闪屏显示 4. 为新的跳过条件添加了适当的日志记录 Log: 当启动已有实例的单例应用时跳过启动闪屏 Influence: 1. 测试在无实例运行时启动单例应用 - 应显示闪屏 2. 测试在已有实例运行时启动单例应用 - 应跳过闪屏 3. 验证系统自启动应用仍按原有方式跳过闪屏 4. 测试非单例应用的行为保持不变 5. 检查日志输出中正确的闪屏跳过消息 --- src/dbus/applicationservice.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dbus/applicationservice.cpp b/src/dbus/applicationservice.cpp index b615b46f..5d22a022 100644 --- a/src/dbus/applicationservice.cpp +++ b/src/dbus/applicationservice.cpp @@ -324,10 +324,14 @@ ApplicationService::Launch(const QString &action, const QStringList &fields, con } // Notify the compositor to show a splash screen if in a Wayland session. - // Suppress splash for system autostart launches. + // Suppress splash for system autostart launches or singleton apps with existing instances. const bool isAutostartLaunch = optionsMap.contains("_autostart") && optionsMap.value("_autostart").toBool(); + const bool isSingleton = findEntryValue(DesktopFileEntryKey, "X-Deepin-Singleton", EntryValueType::Boolean).toBool(); + const bool singletonWithInstance = isSingleton && !m_Instances.isEmpty(); if (isAutostartLaunch) { qCInfo(amPrelaunchSplash) << "Skip prelaunch splash (autostart)" << id(); + } else if (singletonWithInstance) { + qCInfo(amPrelaunchSplash) << "Skip prelaunch splash (singleton with existing instance)" << id(); } else if (auto *am = parent()) { if (auto *helper = am->splashHelper()) { const auto iconVar = findEntryValue(DesktopFileEntryKey, "Icon", EntryValueType::IconString);