Bug 422786 - Global Menu requires refocus to display properly for GTK apps
Summary: Global Menu requires refocus to display properly for GTK apps
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Global Menu (show other bugs)
Version: 5.19.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Janet Blackquill
URL:
Keywords: regression
: 422789 422799 423892 424535 424808 425740 431737 434783 442915 448528 461956 468732 471863 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-06-10 22:18 UTC by noons
Modified: 2023-12-09 04:14 UTC (History)
34 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.27.6


Attachments
Global menu displayed twice on panel with KDE apps in "applet-window-appmenu" (2.28 MB, image/jpeg)
2020-11-22 14:27 UTC, alenertz
Details
Menu greyed out (1.24 MB, video/x-matroska)
2021-02-17 19:39 UTC, Juan Méndez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description noons 2020-06-10 22:18:12 UTC
SUMMARY

With the release of plasma 5.19.0 Global Menu stopped working correctly with GTK apps running within an X session. Upon launching a GTK application the global menu remains empty until you click on a different open window and then click back into the GTK application. The global menu will then work correctly for that app until it is restarted.

STEPS TO REPRODUCE
1. Launch GTK application that previously worked with global menus in 5.18.X
2. Note that no menu options display in the global menu.
3. Click on another window (QT or GTK).
4. Click back to the recently launched GTK application and the menu items should display correctly.

OBSERVED RESULT

Newly launched GTK apps do not show menu items until you click another open window and click back into the GTK window.

EXPECTED RESULT

GTK Menu items should show correctly on application startup.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux X
(available in About System)
KDE Plasma Version: 5.19.0
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION

appmenu-gtk-module 0.7.3-1
community/libdbusmenu-gtk3 16.04.0-4
extra/libdbusmenu-qt5 0.9.3+16.04.20160218-5
Comment 1 Nate Graham 2020-06-11 13:57:41 UTC
*** Bug 422789 has been marked as a duplicate of this bug. ***
Comment 2 Bailey 2020-06-11 14:00:11 UTC
same problem.
Comment 3 Nate Graham 2020-06-11 14:23:44 UTC
*** Bug 422799 has been marked as a duplicate of this bug. ***
Comment 4 r.kunschke 2020-06-11 17:24:58 UTC
For me the problem also appears on QT apps
Comment 5 Guido Sanchez 2020-06-11 17:35:03 UTC
Can confirm with Chromium 83.0.4103.61-0ubuntu0.18.04.1 and LibreOffice 6.4.4.2-2.
Comment 6 Nate Graham 2020-06-11 17:59:15 UTC
*** Bug 422260 has been marked as a duplicate of this bug. ***
Comment 7 Patrik Wyde 2020-06-18 20:42:22 UTC
I can confirm that this happens on all my GTK-based applications. QT applications is not effected.

I had the exact same problem with the last major release of Plasma (5.18). Shortly after that I performed a fresh install with a clean home directory. Hence I suspect it is connected to some user configuration file.
Comment 8 Nate Graham 2020-06-18 22:04:17 UTC
Should be fixed with https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/60
Comment 9 Janet Blackquill 2020-06-18 22:28:47 UTC
Git commit 16613309be67fde120c9b6f1af0c761f794edec4 by Carson Black.
Committed on 18/06/2020 at 22:17.
Pushed by cblack into branch 'master'.

[applets/appmenu] Listen to more signals to ensure that appmenu applet can reliably catch the active window changing
Related: bug 422260

M  +3    -0    applets/appmenu/plugin/appmenumodel.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/16613309be67fde120c9b6f1af0c761f794edec4
Comment 10 Janet Blackquill 2020-06-18 22:29:08 UTC
Git commit fe302963030be0ef137d3b04343cdfbe75887669 by Carson Black.
Committed on 18/06/2020 at 22:29.
Pushed by cblack into branch 'Plasma/5.19'.

[applets/appmenu] Listen to more signals to ensure that appmenu applet can reliably catch the active window changing
Related: bug 422260

M  +3    -0    applets/appmenu/plugin/appmenumodel.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/fe302963030be0ef137d3b04343cdfbe75887669
Comment 11 noons 2020-06-24 01:13:45 UTC
Issue still seems to be occurring with 5.19.2. If I have a QT app open and I open  a GTK app I can see the global menu blink as if it's refreshing, but the menu from the QT app remains. Refocusing the app seems to fix the issue. Reproducible on both my laptop and desktop.
Comment 12 Anjani Kumar 2020-06-25 20:05:16 UTC
This bug still exists on plasma 5.19.2-2 ArchLinux Package. I rely on the global menu heavily  and every time I launch a gtk application I have to refocus the window again. I wonder if they released the package with the patch or not because I just updated it now.
Comment 13 Patrik Wyde 2020-07-09 10:08:01 UTC
This bug was resolved for me with Arch Linux package of plasma 5.19.3-1.
Comment 14 noons 2020-07-09 13:54:50 UTC
(In reply to Patrik Wyde from comment #13)
> This bug was resolved for me with Arch Linux package of plasma 5.19.3-1.

Really? I'm still able to reproduce it, running 5.19.3-1 here.
Comment 15 Patrik Wyde 2020-07-10 09:53:52 UTC
(In reply to noons from comment #14)
> (In reply to Patrik Wyde from comment #13)
> > This bug was resolved for me with Arch Linux package of plasma 5.19.3-1.
> 
> Really? I'm still able to reproduce it, running 5.19.3-1 here.

Interesting. Are you using the global menu widget on a standard Plasma panel or Latte dock/panel? I am using it in a Latte panel.
Comment 16 noons 2020-07-10 13:53:27 UTC
(In reply to Patrik Wyde from comment #15)
> (In reply to noons from comment #14)
> > (In reply to Patrik Wyde from comment #13)
> > > This bug was resolved for me with Arch Linux package of plasma 5.19.3-1.
> > 
> > Really? I'm still able to reproduce it, running 5.19.3-1 here.
> 
> Interesting. Are you using the global menu widget on a standard Plasma panel
> or Latte dock/panel? I am using it in a Latte panel.

The global menu widget / built in plasma panel. I'd imagine latte uses it's own panel/code for the global menu, which is likely why you aren't seeing the issue. It should still work natively in KDE/Plasma for those who don't run latte. Thanks though, I'll check that out as a potential workaround.
Comment 17 Anjani Kumar 2020-07-10 15:58:29 UTC
(In reply to noons from comment #14)
> (In reply to Patrik Wyde from comment #13)
> > This bug was resolved for me with Arch Linux package of plasma 5.19.3-1.
> 
> Really? I'm still able to reproduce it, running 5.19.3-1 here.

Yes, I can reproduce it with 5.19.3-1
Comment 18 Nate Graham 2020-08-24 21:46:11 UTC
*** Bug 425740 has been marked as a duplicate of this bug. ***
Comment 19 Patrik Wyde 2020-08-31 08:23:44 UTC
(In reply to noons from comment #16)
> (In reply to Patrik Wyde from comment #15)
> > (In reply to noons from comment #14)
> > > (In reply to Patrik Wyde from comment #13)
> > > > This bug was resolved for me with Arch Linux package of plasma 5.19.3-1.
> > > 
> > > Really? I'm still able to reproduce it, running 5.19.3-1 here.
> > 
> > Interesting. Are you using the global menu widget on a standard Plasma panel
> > or Latte dock/panel? I am using it in a Latte panel.
> 
> The global menu widget / built in plasma panel. I'd imagine latte uses it's
> own panel/code for the global menu, which is likely why you aren't seeing
> the issue. It should still work natively in KDE/Plasma for those who don't
> run latte. Thanks though, I'll check that out as a potential workaround.

Unfortunately it is broken again under Latte :(

It is unclear when it happened as I do not launch GTK applications on a daily basis.
Comment 20 Nate Graham 2020-09-14 20:25:51 UTC
*** Bug 424808 has been marked as a duplicate of this bug. ***
Comment 21 Nate Graham 2020-09-23 02:21:07 UTC
Getting reports that this is still happening in 5.20.

Carson, can you take another look?
Comment 22 Riccardo Robecchi 2020-10-05 14:00:22 UTC
*** Bug 424535 has been marked as a duplicate of this bug. ***
Comment 23 Riccardo Robecchi 2020-10-05 14:01:10 UTC
*** Bug 423892 has been marked as a duplicate of this bug. ***
Comment 24 Leyenda 2020-10-16 13:48:09 UTC
Same here in 5.20, tested with Gimp.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon User edition 20.04
KDE Plasma Version: 5.20
KDE Frameworks Version: 5.75
Qt Version: 5.15.0
Comment 25 Anjani Kumar 2020-10-20 15:56:37 UTC
Used to work with applications such as intellij-idea ultimate edition and clion but not anymore. I mean it used to work after refocusing but now it doesn't work at all.

Operating System: Arch Linux
KDE Plasma Version: 5.20.0
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.1
Comment 26 Nate Graham 2020-10-21 03:44:19 UTC
*** Bug 427925 has been marked as a duplicate of this bug. ***
Comment 27 boite.pour.spam 2020-11-13 12:46:25 UTC
The similar and more complete widget from https://github.com/psifidotos/applet-window-appmenu
does not show this behavior.
For the bug not to show, you must select both "show active application" and "show main window"
Comment 28 alenertz 2020-11-22 13:18:45 UTC
(in reply to boite.pour.spam@gmail.com,comment 27)

I succeded in compiling and installing "applet-window-appmenu" in Archlinux.After activating this widget,I opened a GTK app and the global menu was immediately displayed on the panel.So.your idea was right! Wonderful,I thought!

But,when I opened a KDE app,surprise: the global menu is displayed twice and simultaneously on the panel.See my screenshot attached here.
Comment 29 alenertz 2020-11-22 14:27:08 UTC
Created attachment 133565 [details]
Global menu displayed twice on panel with KDE apps in "applet-window-appmenu"

I open Dolphin and you see the global menu twice on the panel in widget "applet-window-appmenu".With GTK apps all is well.If I open a GTK app the global menu is immediately dispayed on the panel,as it should."Applet-Window-Appmenu" could be a solution for the bug"Global Menu requires refocus to display properly".
Comment 30 boite.pour.spam 2020-11-22 17:15:52 UTC
(In reply to alexjp.lenertz from comment #29)
> Created attachment 133565 [details]
> Global menu displayed twice on panel with KDE apps in "applet-window-appmenu"
> 
> I open Dolphin and you see the global menu twice on the panel in widget
> "applet-window-appmenu".With GTK apps all is well.If I open a GTK app the
> global menu is immediately dispayed on the panel,as it
> should."Applet-Window-Appmenu" could be a solution for the bug"Global Menu
> requires refocus to display properly".

That's probably because you have both plasma's appmenu and the applet I've described above. Remove own plasma menu, and you should be good to go (that's how I deal with mine).
Comment 31 Juan Méndez 2020-12-31 05:10:33 UTC
I can confirm tht this bug is still present in KDE 5.20.4 (Arch Linux).
Comment 32 Anjani Kumar 2020-12-31 05:12:50 UTC
(In reply to boite.pour.spam from comment #27)
> The similar and more complete widget from
> https://github.com/psifidotos/applet-window-appmenu
> does not show this behavior.
> For the bug not to show, you must select both "show active application" and
> "show main window"

This works great for me.
Comment 33 ParsaMousavi 2021-01-03 08:07:04 UTC
> https://github.com/psifidotos/applet-window-appmenu

This only works for me if there's at least one instance of the "Global Menu" applet present(Can also be put in a spare "Activity",as a less annoying workaround).Otherwise it's useless.Manjaro KDE user here.

It's embarrassing to see still after 6 month such a minor bug hasn't been fixed in an applet with less than 2000 lines of code.Why are there so much underrated stuff in KDE at all? Someone develops a feature that makes its way into mainstream KDE Plasma,then users love it but they encounter some problems and then nobody cares.

I mean either don't write anything that is as buggy as hell or simply be responsible for it(This bug is nothing compared to many other underrated stuff in KDE.I've been a KDE Neon user for a few month and I have a lot to say).
Comment 34 Juan Méndez 2021-01-03 08:14:33 UTC
(In reply to ParsaMousavi from comment #33)
> > https://github.com/psifidotos/applet-window-appmenu
> 
> This only works for me if there's at least one instance of the "Global Menu"
> applet present(Can also be put in a spare "Activity",as a less annoying
> workaround).Otherwise it's useless.Manjaro KDE user here.
> 
> It's embarrassing to see still after 6 month such a minor bug hasn't been
> fixed in an applet with less than 2000 lines of code.Why are there so much
> underrated stuff in KDE at all? Someone develops a feature that makes its
> way into mainstream KDE Plasma,then users love it but they encounter some
> problems and then nobody cares.
> 
> I mean either don't write anything that is as buggy as hell or simply be
> responsible for it(This bug is nothing compared to many other underrated
> stuff in KDE.I've been a KDE Neon user for a few month and I have a lot to
> say).

I mean either fix it by yourself or just don't complain. Devs are doing this in their spare time and for free, no one's got the right to demand, not even you. They're not perfect either to write perfect and bug-less code.

You can wait for it to be resolved or fix it by yourself, after all KDE is FOSS.
Comment 35 David Edmundson 2021-01-09 18:23:37 UTC
It looks like xwindowtasksmodel doesn't emit that ApplicationMenuServiceName changes.

This xprop is set after mapping as it's done async by the converted gmenudbusmenuproxy. Hence it'll breaks till the value is looked up again.
Comment 36 Bug Janitor Service 2021-01-09 18:31:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/562
Comment 37 Janet Blackquill 2021-01-09 19:06:55 UTC
Git commit 2a5ef4e173ff7f24e4a7e895b73978ff0a7b97b6 by Jan Blackquill, on behalf of David Edmundson.
Committed on 09/01/2021 at 19:06.
Pushed by cblack into branch 'master'.

[libtaskmanager] Notify when appmenu path changes

This isn't always static, espcially in GTK apps where the xproperty is
set later by gmenuproxyodel.

The Appmenu applet already watches for this role changing, but it wasn't
hooked up.

The wayland implementation does not have the same bug.

M  +8    -0    libtaskmanager/xwindowtasksmodel.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/2a5ef4e173ff7f24e4a7e895b73978ff0a7b97b6
Comment 38 Nate Graham 2021-01-26 19:23:13 UTC
*** Bug 431737 has been marked as a duplicate of this bug. ***
Comment 39 hd2021 2021-02-16 16:53:50 UTC
plasma 5.21 does not fix this bug.

Applications affected by this bug is :
Google Chrome (installed by .deb from official site)
Microsoft visual studio code (installed by .deb from official site)
Filezilla (installed by apt install filezilla)
Inkscape (installed by ppa from official site)
Jetbrains IDE (installed by jetbrain tools with javafx plugins installed)
and some gtk apps...

BUG description:
When open such apps above, global menu does not show at once unless type alt + tab to switch to some other app and then switch back.
Comment 40 Anjani Kumar 2021-02-17 16:59:45 UTC
I can confirm plasma 5.21 doesn't fix this bug.
Comment 41 Juan Méndez 2021-02-17 19:39:48 UTC
Created attachment 135789 [details]
Menu greyed out

This didn't happen in Plasma 5.20
Comment 42 Juan Méndez 2021-02-17 20:00:52 UTC
Can also confirm this bug in plasma 5.21.

In fact, it seems to be kinda more "buggier", because sometimes even though the menu appears after hitting alt+tab, all the menu options are greyed out. Hitting multiple times alt+tab solves the issue.

I uploaded an attachment so you can reproduce the bug. 

This does seem to be a quite weird behavior which so far hasn't been mentioned in this bug report. Steps to reproduce:

1. Launch GTK app. (I am using Sublime Text 3 for this). 
As expected, the global menu entries won't be there.
2. Switch to another GTK app. (I used firefox for this, idk if I just hit this bug because FF doesn't natively have global menu bar unless you install a patched version).
3. Switch back to your [first] GTK app. The global menu will show, but with greyed out entries. The global menu now shows up but it's literally useless.
4. Switch to a QT app (I used Konsole for this).
5. Switch back to your GTK app. At least for me, now the global menu works just fine.

Please tell me if you need logs in order to get this bug fixed.

Extra data:
kwin 5.21.0-1
plasma-desktop 5.21.0-1
plasma-framework 5.79.0-1
Comment 43 alenertz 2021-02-22 15:57:29 UTC
I can confirm,that this bug is still present in KDE 5.21.Moreover,the global menu still doesn't work with GTK apps in Wayland Session with 5.21.
In normal Plasma X11 Session I use "applet-window-appmenu",that all of you that have the same problem can download from Github and that works wonderfully well.I recommend it here!!
Comment 44 hd2021 2021-03-03 13:18:56 UTC
(In reply to alexjp.lenertz from comment #43)
> I can confirm,that this bug is still present in KDE 5.21.Moreover,the global
> menu still doesn't work with GTK apps in Wayland Session with 5.21.
> In normal Plasma X11 Session I use "applet-window-appmenu",that all of you
> that have the same problem can download from Github and that works
> wonderfully well.I recommend it here!!

Thank you , this applet is great and solve my problem.
Comment 45 David Edmundson 2021-05-08 23:14:23 UTC
Can't reproduce any issues.

Please attach a log of running 

`dbus-monitor --pcap ` and focussing the inkscape window

As well as output from plasmashell --replace


and/or verified steps that work from a clean VM image.
Comment 46 Bug Janitor Service 2021-05-23 04:33:42 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 47 S. Christian Collins 2021-05-23 16:19:41 UTC
David, I tried to capture output for you using `dbus-monitor --pcap`, but I ran into a few issues:
1. I was getting an enormous amount of terminal output through the entire process, much of which includes unreadable characters (e.g., 'reparseConfiguration'C}�`�Y@@l�6�o"/Act)
2. If the konsole window was visible when I ran the test, the global menu bar would show the Inkscape menu after a couple of seconds (perhaps due to all the "Bell in session 'Profile 1'" notification popups?), so I couldn't reproduce the bug. With konsole minimized, the bug occurs, but then I have no idea which output is related to the application re-focusing.

I can reproduce this bug using a clean KDE neon install in VirtualBox using these steps, with global menu bar enabled:
1. Start Inkscape. Inkscape's menu doesn't show in the global menu bar.
2. Click on the desktop (you might need to de-maximize Inkscape first).
3. Click on Inkscape to re-focus it. Now Inkscape's menu will show in the global menu bar.

 You might find that the easiest way to get the info you want, but I'll be happy to share the entire wall of terminal output if you would still find it helpful. Just let me know.
Comment 48 Bug Janitor Service 2021-06-07 04:33:30 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 49 Bug Janitor Service 2021-06-22 04:33:53 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 50 tomashnyk 2021-12-28 19:32:55 UTC
There was a request to produce steps to reproduce this in VM machine and they were provided in comment 47:

"I can reproduce this bug using a clean KDE neon install in VirtualBox using these steps, with global menu bar enabled:
1. Start Inkscape. Inkscape's menu doesn't show in the global menu bar.
2. Click on the desktop (you might need to de-maximize Inkscape first).
3. Click on Inkscape to re-focus it. Now Inkscape's menu will show in the global menu bar."
Comment 51 Nate Graham 2022-01-21 01:40:42 UTC
*** Bug 448528 has been marked as a duplicate of this bug. ***
Comment 52 galder 2022-01-26 14:28:49 UTC
moving to confirmed
Comment 53 Aleksana 2022-08-10 17:23:00 UTC
Can still reproduce on Plasma 5.25.4 and KDE framework5.96.0, xorg session running chromium, all electron and gtk applications.
Comment 54 ratijas 2022-09-21 00:54:33 UTC
*** Bug 434783 has been marked as a duplicate of this bug. ***
Comment 55 Nate Graham 2022-11-29 19:50:46 UTC
*** Bug 461956 has been marked as a duplicate of this bug. ***
Comment 56 Nate Graham 2023-04-24 16:37:36 UTC
*** Bug 468732 has been marked as a duplicate of this bug. ***
Comment 57 Bug Janitor Service 2023-04-26 21:44:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2870
Comment 58 David Edmundson 2023-05-14 09:51:51 UTC
Git commit 94a04a556cec8f06e592d7d7feb7ec70fa4ca227 by David Edmundson, on behalf of Severin von Wnuck.
Committed on 14/05/2023 at 08:23.
Pushed by davidedmundson into branch 'master'.

libtaskmanager: Fix appmenu caching

The appmenu properties are not propagated to
the cached `KWindowInfo` due to missing window flags.
Forcing the creation of a new `KWindowInfo` with the correct flags
allows the appmenu to be displayed without requiring any refocusing.
Also fixes the caching for activities.

M  +3    -0    libtaskmanager/xwindowtasksmodel.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/94a04a556cec8f06e592d7d7feb7ec70fa4ca227
Comment 59 Nate Graham 2023-05-14 12:11:25 UTC
Git commit c09da5100aad95a49ba274729b144f6cb89e4706 by Nate Graham, on behalf of Severin von Wnuck.
Committed on 14/05/2023 at 12:11.
Pushed by ngraham into branch 'Plasma/5.27'.

libtaskmanager: Fix appmenu caching

The appmenu properties are not propagated to
the cached `KWindowInfo` due to missing window flags.
Forcing the creation of a new `KWindowInfo` with the correct flags
allows the appmenu to be displayed without requiring any refocusing.
Also fixes the caching for activities.


(cherry picked from commit 94a04a556cec8f06e592d7d7feb7ec70fa4ca227)

M  +3    -0    libtaskmanager/xwindowtasksmodel.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/c09da5100aad95a49ba274729b144f6cb89e4706
Comment 60 Nate Graham 2023-09-07 18:09:09 UTC
*** Bug 471863 has been marked as a duplicate of this bug. ***
Comment 61 Nate Graham 2023-12-09 04:14:45 UTC
*** Bug 442915 has been marked as a duplicate of this bug. ***