https://bugs.kde.org/show_bug.cgi?id=404643
Bug ID: 404643
Summary: Launching a second instance of single-instance
application doesn't give focus to the running instance
at Low or higher focus stealing prevention level
Product: kwin
Version: 5.15.0
Platform: Manjaro
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: core
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
SUMMARY
*Important*: the issue happens much more often if the already running instance
of the application is *not* hidden to tray or minimized, when it is visible but
behind one or more other windows.
This issue is application-dependent. When a second instance of a
single-instance application is launched (from Konsole, Application Launcher or
KRunner), the corresponding primary instance gets focus with
inconsistent-across-applications focus stealing settings. I tested only
different focus stealing prevention levels, have set all other Window
Management settings to Defaults.
The following table lists applications and focus stealing prevention levels
that give them focus (based on my testing in Plasma 5.14.5 and 5.15.0):
Level Applications
<any> (systemsettings5, KDevelop and KInfocenter)
<High (GoldenDict, Thunderbird, medit)
<Low ("qtcreator -client", Pidgin, Qmmp, LibreOffice, Calibre, Audacious,
gnome-disks, <all other non-KDE apps I tested>)
I suppose applications that get focus at any level use
KWindowSystem::forceActiveWindow() as described here:
https://api.kde.org/frameworks/kdbusaddons/html/classKDBusService.html#af0ad38f597aedaf22a30045d0423ed0e
Those few apps that get focus at levels lower than _High_ probably use custom
workarounds. For example, GoldenDict uses X11 API to emulate a left mouse
button click in the top-left corner of its main window to get focus.
The apps that get focus only at the _None_ level use regular high-level APIs
such as the following Qt-based application code:
qApp->setActiveWindow( this );
raise();
activateWindow();
SOFTWARE/OS VERSIONS
Linux: Manjaro 64-bit
KDE Plasma Versions: 5.15.0, 5.14.5
KDE Frameworks Versions: 5.55.0, 5.54.0
Qt Versions: 5.12.1, 5.12.0
ADDITIONAL INFORMATION
>From KDE documentation
(https://docs.kde.org/trunk5/en/kde-workspace/kcontrol/windowbehaviour/index.html):
Focus stealing prevention level -> Low:
Prevention is enabled; when some window does not have support for the
underlying mechanism and KWin cannot reliably decide whether to activate the
window or not, it will be activated. This setting may have both worse and
better results than the medium level, depending on the applications.
What "underlying mechanism" do the docs refer to? KDE frameworks APIs,
KWindowSystem? If most non-KDE applications do not have support for "the
underlying mechanism", then I think that the current KWin behavior does not
match this documentation.
This issue came up as I tried to remove the low-level X11 mouse-click-emulation
workaround from GoldenDict. Without the ugly workaround GoldenDict doesn't get
focus when a second instance is launched on Plasma desktop. See my thoughts
about possible alternative ways to get focus from the second instance here:
https://github.com/goldendict/goldendict/issues/781#issuecomment-462841795.
How should non-KDE, pure-Qt, single-instance applications request focus on
second instance launch to get it in all Plasma versions?
--
You are receiving this mail because:
You are watching all bug changes.