Bug 340871 - Applications open in background when opened from system tray
Summary: Applications open in background when opened from system tray
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: 5.1.1
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: 5
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-12 04:07 UTC by Sudhir Khanger
Modified: 2023-09-06 10:39 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Problem screencast (2.49 MB, video/x-matroska)
2015-01-10 14:10 UTC, Sudhir Khanger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sudhir Khanger 2014-11-12 04:07:42 UTC
When I click system tray applet of applications like KeePassX, ownCloud desktop client, etc. they open in background instead of foreground. Then I have to bring them to foreground by clicking their icon in the taskbar. This is an additional step that could be avoided.

Reproducible: Always

Steps to Reproduce:
1. Click KeePassX or ownCloud desktop client system tray icon in closed state.
2.
3.

Actual Results:  
Apps open in background

Expected Results:  
Apps should open in foreground
Comment 1 Bhushan Shah 2014-11-13 03:46:07 UTC
This looks like you need to adjust your focus settings, here is my settings http://imgur.com/lE7W3AS and it works perfectly fine for me
Comment 2 Sudhir Khanger 2014-11-13 08:51:28 UTC
@Bhushan it did nothing for me.
Comment 3 Sudhir Khanger 2014-12-05 04:17:01 UTC
Even KDE 4 apps are affected. Generally apps would open in foreground but then something happens and randomly all apps would open in background. KeePassX, ownCloud Clinet, etc. are prominent examples.
Comment 4 Sudhir Khanger 2014-12-24 12:53:53 UTC
Bhushan is there a reason you are using Medium in Focus Stealing Prevention. System default is low which doesn't seem to work for me.

If I set it to None then all apps open in foreground even things like Open Terminal from Dolphin toolbar which generally doesn't open in foreground.
Comment 5 Martin Flöser 2015-01-07 10:18:59 UTC
properly reassign to KWin.

I cannot reproduce. For me the applications open in foreground.
Comment 6 Thomas Lübking 2015-01-07 15:06:52 UTC
1. From *what* systemtray?
Plasma-desktop 4 or 5?
In case of 5, some 3rd party systray or do those applications support SNI in your installation?
(KeePassX is atm. provided Qt4 only by my distro)

2. what has the focus instead?
Comment 7 Martin Flöser 2015-01-07 15:19:41 UTC
oh yeah missed to add that one: I tested with SNI in a plasma 5 setup and good old xembed using wmsystemtray.
Comment 8 Sudhir Khanger 2015-01-09 15:45:26 UTC
1. I have this issue with both KDE 4 and Plasma 5. I have the problem with default KDE system tray. I do have qt-sni installed on my system.

2. All KWin settings are system defaults. Focus is set to Low.

I will take a quick screencast once I am back from travel.
Comment 9 Sudhir Khanger 2015-01-10 14:10:38 UTC
Created attachment 90322 [details]
Problem screencast

As you can see in this video that when KeePassX and ownCloud client are activated from the default KDE 4 system tray they may or may not be made available in foreground. Transmission-qt is another application that misbehaves when activated from system tray. Although i am not able to replicate the problem with Transmission at the moment.

I was using Plasma 5 when I filed the bug. I am back on KDE 4 and the problem seem to exist in both KDE 4 and Plasma 5.
Comment 10 Thomas Lübking 2015-01-10 17:47:57 UTC
it looks like the owncloud client messes around the focus.
Can you reproduce this while leaving it out? (ie. kill the process)

I tried keepassx and transmission-qt in plasma/4 and kwin 4/5 (we don't know about the systray in plasma/5, while transmission uses SNI here) w/o any problem.

No owncloud on this box.
Comment 11 contacha 2018-11-12 18:04:18 UTC
Same issue. 

Kmail icon in system tray only takes one click to open the program,

Keepassxc, Qownnotes and nextcloud-client require 3 clicks.
Comment 12 Patrick Silva 2019-04-14 15:43:53 UTC
I can confirm with keepassx 0.4.4 Qt4 on Arch Linux.
Set focus stealing prevention to "None" solves the problem.

Operating System: Arch Linux 
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.57.0
Qt Version: 5.12.2
Comment 13 Patrick Silva 2019-04-14 22:18:38 UTC
I also can reproduce with the following kde apps that can be minimized to systray:
kmail
kget
ktorrent
juk

Open Kmail
Open Kmail settings and check "Enable system tray icon" in "Appearance" section
Apply the setting and close Kmail
open systray settings, click "Entries" section, check "Always shows all entries"
apply the setting
close all windows
open Dolphin
maximize and minimize Dolphin window
open Kmail and minimize it by clicking its icon in systray
unminimize Dolphin by cliking its entry in the task manager
click Kmail icon in the systray
Result: Kmail entry shows up in the task manager but Kmail window
is not focused. Dolphin is still in foreground.

The same behavior can be reproduced replacing Kmail with any kde app mentioned above.

kmail 5.10.3
kget 18.12.3
ktorrent 5.1.1
juk 18.12.3
Operating System: Arch Linux 
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.57.0
Qt Version: 5.12.2
Comment 14 Guillaume Castagnino 2020-04-19 12:26:04 UTC
I can confirm this behaviour with applications opening from systray

Some examples all Qt applications:
- nextcloud
- keepassxc
- strawberry
- tel.red sky (well, this one is proprietary and damn buggy, so we may ignore it)

Set focus stealing prevention to Low.
Behaviour may change depending on the application, since click on systray icon leads to different behaviour

Example 1, with strawberry:
- For example open firefox and dolphin. Give the focus to dolphin
- the first time I click the strawberry systray icon, the application is opened, but it stay below dolphin, but above firefox. Does not get the focus.
- second click on the icon, the window comes on top and get the focus
- third click, the window is closed, focus is back on dolphin
- fourth click, this time, strawberry opens directly on top, with focus (correct behaviour)
- fifth click, it closes
- sixth click is the same as the fourth, etc… But if I click again inside dolphin, I’m back to the initial behaviour

Example 2 with sky:
- For example open firefox and dolphin. Give the focus to dolphin
- the first time I click the tel.red sky systray icon, the application is opened, but it stay below dolphin, but above firefox. Does not get the focus
- second click close the window
- third click open again, but this time on top and with focus (correct behaviour)
- same as for strawberry, the behaviour is OK until I click on dolphin, in such case I’m back to the begining

With nextcloud on keepassxc, It seems more random, or at least I did not get the clue. Sometime it behaves correctly, and sometime it opens without focus just behind the topmost window.


If I disable the focus stealing prevention, all four apps behave correctly. But this is not a very good workaround as in such case, some popups get the focus when it’s not desirable.


Currently using plasma/kwin 5.18.4.1 under Gentoo, but this was the same with 5.17 or below.
Comment 15 David Edmundson 2023-09-06 10:39:06 UTC
This bug was reported against an outdated version of KWin. We have made many changes since the. 
If the issue persists in newer versions can you reopen the bug report updating the version number.