Bug 449870 - Tray icons don't react to right click
Summary: Tray icons don't react to right click
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: System Tray (show other bugs)
Version: 5.24.0
Platform: Neon Linux
: VHI normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression
: 449879 449928 449963 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-02-09 15:39 UTC by Michael
Modified: 2022-02-14 18:50 UTC (History)
13 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.24.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2022-02-09 15:39:10 UTC
SUMMARY
***
Tray icons like discord and gxneur (legacy), don't react to right mouse click. No menu shows up. Worked in the previous version (5.23.5).
***

SOFTWARE/OS VERSIONS
5.16.8-gentoo
Linux/KDE Plasma: 5.24
(available in About System)
KDE Plasma Version: 5.24
KDE Frameworks Version:  5.90
Qt Version: 5.15.2
Comment 1 Michael 2022-02-09 16:11:31 UTC
Notably Viber's tray icon menu works as it should.
Comment 2 Behzad A 2022-02-09 19:35:44 UTC
*** Bug 449879 has been marked as a duplicate of this bug. ***
Comment 3 Michael 2022-02-09 21:08:19 UTC
Skype's icon doesn't show the menu either.
Comment 4 Nikos Chantziaras 2022-02-10 04:32:34 UTC
I have the exact same issue.  Downgrading to 5.23.5 fixes it.

A workaround is to install libappindicator, which is detected by discord and makes it use a different method to implement its tray icon. However, this is far from a good workaround because then there's no left click support anymore. Both right and left clicking on the tray icon will simply open the same context menu. Normally, what you want is not have libappindicator installed so that a left click on the tray icon will unminimize discord, and a right click will open the context menu, like in virtually any other application that has a tray icon.
Comment 5 Claudio 2022-02-10 09:34:03 UTC
Same problem here since the upgrade from 5.23.90 to 5.24 - Discord and Gajim right click menus in the taskbar are no longer working. At the moment of the right click the following entry appears in the journal:

plasmashell[818]: Could not find DBusMenu interface, falling back to calling ContextMenu()
Comment 6 Claudio 2022-02-10 10:47:19 UTC
OK you can ignore my previous post about the journal entry regarding "DBusMenu interface", as it also appears when downgrading to the still working plasma-workspace 5.23.90.

I browsed through the git history and reverting part of the changes in StatusNotifierItem.qml of commit ae5f355a992786834babc952c616b21929cd3a97 makes the right click menu appear again.

I just readded the following at line 61 and then everything works as expected:

 case Qt.RightButton:
            openContextMenu(pos);
            break;
Comment 7 Behzad A 2022-02-10 12:09:16 UTC
*** Bug 449928 has been marked as a duplicate of this bug. ***
Comment 8 Noah Davis 2022-02-10 14:28:16 UTC
I can't reproduce this on git master. Maybe a commit depending on KF5.91 was cherry-picked to Plasma 5.24 too soon?
Comment 9 Nicolas Fella 2022-02-10 14:30:53 UTC
Which app did you test? It doesn't happen with apps using "proper" SNIs, so all KDE apps, Electron etc

I can reproduce it on master with Gajim
Comment 10 Noah Davis 2022-02-10 14:33:24 UTC
(In reply to Nicolas Fella from comment #9)
> Which app did you test? It doesn't happen with apps using "proper" SNIs, so
> all KDE apps, Electron etc
> 
> I can reproduce it on master with Gajim

I tested Discord since the reporter said they had a problem with it.
Comment 11 Noah Davis 2022-02-10 14:37:15 UTC
Ok, I can reproduce this with Gajim
Comment 12 Noah Davis 2022-02-10 14:39:04 UTC
(In reply to Nicolas Fella from comment #9)
> Which app did you test? It doesn't happen with apps using "proper" SNIs

What makes an SNI "proper" or "improper"?
Comment 13 Nicolas Fella 2022-02-10 15:00:05 UTC
What I'm referring to is StatusNotifierItem vs xembed tray icons. Although I'm not 100% sure that's the relevant difference here
Comment 14 Michael 2022-02-10 15:45:28 UTC
(In reply to Claudio from comment #6)
> I browsed through the git history and reverting part of the changes in
> StatusNotifierItem.qml of commit ae5f355a992786834babc952c616b21929cd3a97
> makes the right click menu appear again.
> 
> I just readded the following at line 61 and then everything works as
> expected:
> 
>  case Qt.RightButton:
>             openContextMenu(pos);
>             break;

Could you make it into a patch on top of 5.24 so I could test? I'd very much appreciate that.
Comment 15 Michael 2022-02-10 16:19:08 UTC
Okay, I did the manual partial undoind of ae5f355a99 and it fixes the issue.
Comment 16 Nick Stefanov 2022-02-10 19:10:30 UTC
My findings so far:
Tixati, Teams, Discord, Skype, Jdownloader. All with missing context menu. Is 5.24 still in alpha???
Comment 17 Nick Stefanov 2022-02-10 19:13:35 UTC
*** Bug 449963 has been marked as a duplicate of this bug. ***
Comment 18 maetthu 2022-02-11 12:20:10 UTC
Slack and 1password are also affected (both electron)
Comment 19 gromky 2022-02-11 12:41:45 UTC
Same problem in Deadbeef player and Altus (Whatsapp client)
Comment 20 Nick Stefanov 2022-02-11 12:55:01 UTC
@Michael
How we can apply your patch? This weird bug literally ruins my workflow :(
Comment 21 Noah Davis 2022-02-11 13:30:25 UTC
(In reply to Nick Stefanov from comment #20)
> @Michael
> How we can apply your patch? This weird bug literally ruins my workflow :(

A quicker self-fix would be to install libappindicator. It seems we missed this bug because every KDE dev who tested the patch had libappindicator installed.
Comment 22 Nick Stefanov 2022-02-11 13:43:29 UTC
@Noah Davis
Thank you for your suggestion but unfortunately ibappindicator is not an option for me. Some of the reasons are very well described in comment 4:
https://bugs.kde.org/show_bug.cgi?id=449870#c4
Comment 23 Nate Graham 2022-02-11 14:34:43 UTC
Heh maybe I'll remove libappindicator so I can catch future regressions in this use case.
Comment 24 Michael 2022-02-11 14:40:52 UTC
(In reply to Nick Stefanov from comment #20)
> @Michael
> How we can apply your patch? This weird bug literally ruins my workflow :(

There is no patch. I went and partially undid this commit https://invent.kde.org/plasma/plasma-workspace/-/commit/ae5f355a992786834babc952c616b21929cd3a97
namely the changes to StatusNotifierItem.qml and then rebuilt and reinstalled. How to do all that in your distro, I frankly have no idea.
Comment 25 Nick Stefanov 2022-02-11 15:47:21 UTC
Ah, thanks, let's hope it will be fixed quick.
Comment 26 Michael 2022-02-11 15:51:54 UTC
(In reply to Noah Davis from comment #21)
> A quicker self-fix would be to install libappindicator. It seems we missed
> this bug because every KDE dev who tested the patch had libappindicator
> installed.

I don't know about that. I played with libappindicator, and while it does help discord, old gtk apps (gxneur) still don't have the tray menu. I suspect it'll be the same for gajim.
Comment 27 Claudio 2022-02-11 19:19:23 UTC
For a workaround just add to the following file on your system (make a backup copy before):
/usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/ui/items/StatusNotifierItem.qml
at line 61 the following 3 lines with your texteditor of choice  (nano, kate or whatever):

case Qt.RightButton:
            openContextMenu(pos);
            break;

Now run "plasmashell --replace" and the right click menu is working again - no need to compile anything yourself.
Comment 28 Michael 2022-02-11 19:45:45 UTC
@Claudio
Thanks, I didn't realize you don't need that file for compilation.
Comment 29 Nick Stefanov 2022-02-11 22:26:46 UTC
@Michael
Yep, it's working! Thank you so much!!!
Comment 30 Matt 2022-02-12 07:36:51 UTC
@Claudio - You are awesome!  Thank you so much!
Comment 31 Bug Janitor Service 2022-02-14 16:37:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1455
Comment 32 Nate Graham 2022-02-14 18:14:20 UTC
Git commit 03f982261b7f329b42d490651efca1f115cbf097 by Nate Graham, on behalf of Claudio Holo.
Committed on 14/02/2022 at 18:13.
Pushed by ngraham into branch 'master'.

applets/systemtray: fix SNI context menu usage without libappindicator

StatusNotifierItem.qml does not explicitly handle the case of
right-clicking, which causes right-clicks to be ignored unless you also
happen to have the libappindicator package installed, which injects a
handler for this itself. But this should work even if you don't have
that package installed; this commit fixes it.
FIXED-IN: 5.24.1

M  +3    -0    applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml

https://invent.kde.org/plasma/plasma-workspace/commit/03f982261b7f329b42d490651efca1f115cbf097
Comment 33 Nate Graham 2022-02-14 18:14:48 UTC
Git commit b53fec3714c68ae6191f3c2207e7b7a06b53d9f5 by Nate Graham, on behalf of Claudio Holo.
Committed on 14/02/2022 at 18:14.
Pushed by ngraham into branch 'Plasma/5.24'.

applets/systemtray: fix SNI context menu usage without libappindicator

StatusNotifierItem.qml does not explicitly handle the case of
right-clicking, which causes right-clicks to be ignored unless you also
happen to have the libappindicator package installed, which injects a
handler for this itself. But this should work even if you don't have
that package installed; this commit fixes it.
FIXED-IN: 5.24.1


(cherry picked from commit 03f982261b7f329b42d490651efca1f115cbf097)

M  +3    -0    applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml

https://invent.kde.org/plasma/plasma-workspace/commit/b53fec3714c68ae6191f3c2207e7b7a06b53d9f5
Comment 34 Nick Stefanov 2022-02-14 18:50:05 UTC
Thank you!