Bug 484216

Summary: System Tray popups close immediately when opened when using a bottom or right screen edge panel and "Application" or "Window" keyboard layout switching mode
Product: [Plasma] plasmashell Reporter: gudvinr+kde
Component: System TrayAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: beaux_monde, dmitry.myachin, fedramblo, materka, nate, thesourcehim, zawertun
Priority: HI    
Version: 6.0.2   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 6.1
Sentry Crash Report:
Attachments: reproduction
Keyboard1
Bug example

Description gudvinr+kde 2024-03-22 07:34:27 UTC
SUMMARY

Sometimes, if I click on plasmoid in tray, it shows plasmoid background and then immediatly closes.
Doesn't matter if it's built-ins like music player, clipboard, wireless, etc or third-party plasmoids.

I found one way to reproduce it consistently but I don't know what's the actual reason.

STEPS TO REPRODUCE
1. Open Telegram Desktop window
2. Click on plasmoid

OBSERVED RESULT
Plasmoid opens its window

EXPECTED RESULT
Popup closes immediately

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.6.22-1-lts (64-bit)
Graphics Platform: X11
Comment 1 Nate Graham 2024-04-11 21:11:04 UTC
Are you sure your mouse isn't broken and sending double-clicks? Maybe you can test on some files in Dolphin? I had this happen before once and it was a hardware problem.
Comment 2 gudvinr+kde 2024-04-12 05:49:10 UTC
Yes, I am sure my mouse isn't broken.

I also had this happen with only firefox open and when I click on any plasmoid in tray, popup immediately closed.
But when I click on tray arrow and only then on plasmoid, then popup doesn't close.
Comment 3 gudvinr+kde 2024-04-12 11:11:33 UTC
Not sure if it's Qt, Plasma or Kernel update but I don't have focus loss issues anymore.
And apparently other issues I had (e.g. some windows didn't close when I click on their tray icon) also don't reproduce anymore.

Attaching current versions for the reference, if anyone else have this issue or it will happen in the future again.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.7.0
Kernel Version: 6.6.26-1-lts (64-bit)
Graphics Platform: X11
Comment 4 gudvinr+kde 2024-04-15 13:44:49 UTC
No, it wasn't fixed and I think I found a reproduction:
1. Switch to non-default keyboard layout
2. Click on any plasmoid in tray that opens popup (wireless, audio, etc) but not arrow down

I think you need to have keyboard layout switcher (not sure, maybe just having multiple layouts will work)
Comment 5 dmitry.myachin 2024-04-16 19:16:03 UTC
Confirm

Arch, 6.8.5-arch1-1
plasmashell 6.0.3
Wayland
Comment 6 dmitry.myachin 2024-04-16 19:18:29 UTC
Created attachment 168588 [details]
reproduction
Comment 7 Max 2024-04-25 11:34:32 UTC
I confirm the same is happening for me. If non-english keyboard layout is selected then I can not open any popup from any tray icon - it's just closed right away.

Operating System: Fedora Linux 40
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.8.7-300.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Comment 8 Nate Graham 2024-04-26 16:21:40 UTC
Max, that sounds like s different issue, most likely Bug 485456.

guvindr+kde and Dmitry, thanks for the screen recording, but when I do the same thing, I don't see that issue. When I switch to the Russian keyboard layout and click on other system tray icons, everything works as expected.

Is the issue happening for either of you in a new clean user account? Can you check?
Comment 9 dmitry.myachin 2024-04-26 16:47:17 UTC
(In reply to Nate Graham from comment #8)
> Max, that sounds like s different issue, most likely Bug 485456.
> 
> guvindr+kde and Dmitry, thanks for the screen recording, but when I do the
> same thing, I don't see that issue. When I switch to the Russian keyboard
> layout and click on other system tray icons, everything works as expected.
> 
> Is the issue happening for either of you in a new clean user account? Can
> you check?

1. Settings → Keyboard → Layouts → Switching policy
2. Set to "Window"
3. Also enabled "Configure layouts" and added English (US) and Russian
4. Also Main shortcuts is CapsLock and 3d level is RAlt
Comment 10 dmitry.myachin 2024-04-26 16:49:30 UTC
Created attachment 168927 [details]
Keyboard1

Screenshot 1. These settings are create the problem
Comment 11 dmitry.myachin 2024-04-26 16:52:52 UTC
(In reply to dmitry.myachin from comment #10)
> Created attachment 168927 [details]
> Keyboard1
> 
> Screenshot 1. These settings are create the problem

Also enabled extra typographic characters and Kill X.

I set same settings in a new profile and got the problem again. It's the policy, I guess
Comment 12 Max 2024-04-27 06:47:44 UTC
I can partially confirm that it seems to be somehow connected to policy, but for me it's inconsistent. Sometimes after I switch policy (to application or window) tray popups start to work properly on any layout but other time this bug manifests. Maybe something happens during switching/initialization of a policy?
Comment 13 Nate Graham 2024-04-29 20:46:32 UTC
I'm on Qt 6.7 now, and I've replicated those settings exactly, but still can't reproduce the issue. :(
Comment 14 gudvinr+kde 2024-04-30 00:14:04 UTC
I have per-application (not per window) layout and I didn't have an issue when I boot previously.
But I had it when I started PC for the last session and I have en layout as default.

So, after that I:
1. Closed all windows
2. Focused on desktop
3. Switched layout to secondary
4. Opened different app

In this case I had no issue no matter what keyboard layout is active in opened app (either en or secondary).

Then I:
1. Closed all windows
2. Focused on desktop
3. Switched layout to en
4. Opened an app

And I can reproduce an issue again:
If I switch layout to secondary while I'm in the app, popup windows start to erratically close.
If I switch it back to en, it works alright.

I used Firefox for all of my experiments but I don't think it matters because I have seen it with other apps as well
Comment 15 Max 2024-04-30 09:14:28 UTC
I just noticed something: when this problem happens (i.e. I click on a tray icon and popup disappears), keyboard layout tray icon also plays animation like it was also clicked though it was not, layout is not changed though.
Comment 16 decker23 2024-05-01 17:40:56 UTC
Created attachment 169080 [details]
Bug example

Same problem. Incredibly annoying bug. Stably observed when switching policy “window” or “application”.

Fedora 40, Kernel 6.8.7, KDE Plasma 6.0.4, KDE Frameworks: 6.1.0, Wayland
Comment 17 Nate Graham 2024-05-01 17:56:00 UTC
I see why I couldn't reproduce it before: it only seems to happen with a panel on the bottom or right screen edge. I normally use a left screen edge panel.

Can reproduce the issue 100% with a bottom or right screen edge panel.
Comment 18 Nate Graham 2024-05-06 22:03:50 UTC
*** Bug 486661 has been marked as a duplicate of this bug. ***
Comment 19 Serge Roussak 2024-05-07 08:04:45 UTC
I found one workaround to escape the Plasma reloading in order to kick away the bug:
1. Open the tray options dialog.
2. Change the icons size and apply.
3. Change it back and press OK.
Comment 20 gudvinr+kde 2024-05-07 13:38:12 UTC
(In reply to Nate Graham from comment #17)
> I see why I couldn't reproduce it before: it only seems to happen with a
> panel on the bottom or right screen edge. I normally use a left screen edge
> panel.
> 
> Can reproduce the issue 100% with a bottom or right screen edge panel.

I use left and top panels, tray and indicator located at the top one.
Comment 21 Serge Roussak 2024-05-08 10:47:17 UTC
(In reply to Serge Roussak from comment #19)
> I found one workaround to escape the Plasma reloading in order to kick away
> the bug:
> 1. Open the tray options dialog.
> 2. Change the icons size and apply.
> 3. Change it back and press OK.

For the second time this workaround didn't help... :(
Comment 22 Nate Graham 2024-05-24 14:35:03 UTC
Exact steps to reproduce for me:

1. Move panel to the right screen edge, if it's not already there
2. Settings → Keyboard → Layouts → Switching policy → Set to "Window"
3. Enabled "Configure layouts" and add another keyboard layout, if you don't already have two. I added Greek
4. Click on keyboard layout switcher in the System Tray to switch to the new layout (Greek in my case)
5. Click on an icon in the system tray that is NOT the arrow

The popup opens, the keyboard layout visibly flickers back and forth between the two languages, and then the popup immediately closes.
Comment 23 Bug Janitor Service 2024-05-27 14:28:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2270
Comment 24 Marco Martin 2024-05-28 07:38:49 UTC
Git commit 08ad711936ddac4d3d7ea3114a09844d8fa969c5 by Marco Martin.
Committed on 28/05/2024 at 07:38.
Pushed by mart into branch 'master'.

Don't activate plasmoid on layout change

Activating the plasmoid when the layout changes doesn't actually do anything
the only thing that it does is to close the systray popup if it's open,
which is not something that we want.

What's needed is actually the other way around, change the layout when activated,
to make the shortcut work

M  +2    -7    applets/keyboardlayout/contents/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/08ad711936ddac4d3d7ea3114a09844d8fa969c5
Comment 25 Marco Martin 2024-05-28 13:20:03 UTC
Git commit dc7db75296b3b2edbae22ce365e619a2fced2d3a by Marco Martin.
Committed on 28/05/2024 at 07:39.
Pushed by mart into branch 'Plasma/6.1'.

Don't activate plasmoid on layout change

Activating the plasmoid when the layout changes doesn't actually do anything
the only thing that it does is to close the systray popup if it's open,
which is not something that we want.

What's needed is actually the other way around, change the layout when activated,
to make the shortcut work


(cherry picked from commit 08ad711936ddac4d3d7ea3114a09844d8fa969c5)

b8b28b62 Don't activate plasmoid on layout change
4998fcdb switch layout on activation

M  +2    -7    applets/keyboardlayout/contents/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/dc7db75296b3b2edbae22ce365e619a2fced2d3a