helloSystem / Menu

Global menu bar written in Qt
43 stars 14 forks source link

chromium no menu on new window [fixed] #149

Closed jsm222 closed 1 year ago

jsm222 commented 1 year ago

Hi Chromium reuses service for new windows but gets a new object path, so this patch should fix subject.

diff --git a/src/appmenu/menuimporter.cpp b/src/appmenu/menuimporter.cpp
index 049cc1e..d0e4128 100644
--- a/src/appmenu/menuimporter.cpp
+++ b/src/appmenu/menuimporter.cpp
@@ -68,8 +68,10 @@ void MenuImporter::RegisterWindow(WId id, const QDBusObjectPath &path)
     KWindowInfo info(id, NET::WMWindowType, NET::WM2WindowClass);
     NET::WindowTypes mask = NET::AllTypesMask;
     QString service = message().service();
-    if (!m_serviceWatcher->watchedServices().contains(service)) {
+    if (!m_serviceWatcher->watchedServices().contains(service) || m_menuPaths[id]!=path) {
+       if(!m_serviceWatcher->watchedServices().contains(service)) {
         m_serviceWatcher->addWatchedService(service);
+       }
     } else {
         emit WindowRegistered(id, service, m_menuPaths[id]);
probonopd commented 1 year ago

Thank you very much. Added in

https://github.com/helloSystem/Menu/commit/cc434c030f46210c7e2399bb4ebb3a99e6a13f0b