https://bugs.kde.org/show_bug.cgi?id=404643
--- Comment #4 from Igor Kushnir <[email protected]> --- > >How should non-KDE, pure-Qt, single-instance applications request focus on > >second instance launch to get it in all Plasma versions? > > Pass the startup ID to the second instance. See QX11Info::setNextStartupId() > then calling activate will "just work" 1. When an application is launched from terminal, it gets an empty QX11Info::nextStartupId(). So this simple implementation can't work as well as KDE applications in this case. 2. Even when I pass a nonempty QX11Info::nextStartupId() from the secondary instance, then pass it to QX11Info::setNextStartupId() in the primary instance, then activate the primary instance's main window, it still doesn't get focus if it is not minimized/hidden. So I haven't noticed any effect of the simple implementation. I use QtSingleApplication to pass messages between instances. Code that runs in the primary instance: QByteArray startupId = QByteArray::fromBase64(receivedBase64EncodedId); qCritical() << startupId; QX11Info::setNextStartupId(startupId); qApp->setActiveWindow(this); raise(); activateWindow(); A typical received id in a KDE neon VM is "KDE-neon-VM;1551168703;784674;950_TIME254792". I tried removing the "qApp->setActiveWindow(this)" line, reordering "raise()" and "activateWindow()" lines; setting StartupNotify both to true and false in the application desktop file. But nothing makes a difference. Does the secondary instance have to explicitly send the "remove" message to end the launch sequence as described in https://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt? -- You are receiving this mail because: You are watching all bug changes.
