Skip window activation in convergence mode

In phone mode, tapping a running app activates its existing
window. In convergence mode this prevents launching a new
instance of the same application.

Skip activateWindowByStorageId when convergence mode is
enabled so that launchApp is always reached, matching
standard desktop launcher behaviour.
This commit is contained in:
Marco Allegretti 2026-04-10 13:03:57 +02:00
parent 29ce5117ff
commit 70c1810d82

View file

@ -3,6 +3,8 @@
import QtQuick
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
// NOTE: This is a singleton in the mobileshell library, so we need to be careful to
// make this load as fast as possible (since it may be loaded in other processes ex. lockscreen).
@ -15,6 +17,7 @@ QtObject {
* Activates an application by storage id if it is already running, or launch the application.
*/
function launchOrActivateApp(storageId) {
const skipActivate = ShellSettings.Settings.convergenceModeEnabled;
// We don't want to import WindowPlugin initially because it has side-effects and slows down initial load.
// -> only import it if we actually run the function
@ -25,11 +28,11 @@ QtObject {
QtObject {
Component.onCompleted: {
const launched = WindowPlugin.WindowUtil.activateWindowByStorageId("${storageId}");
if (!launched) {
MobileShell.ShellUtil.launchApp("${storageId}");
if (!${skipActivate}) {
const launched = WindowPlugin.WindowUtil.activateWindowByStorageId("${storageId}");
if (launched) return;
}
MobileShell.ShellUtil.launchApp("${storageId}");
}
}
`, root, "runSnippet");