M7S / dockbarx

286 stars 39 forks source link

Problem with pwa #138

Open byter00 opened 4 years ago

byter00 commented 4 years ago

When i install a pwa from Chrome and i start it, Chrome icon start to active and not the pwa icon pwa_dockbarx

insolite commented 2 years ago

Having the same issue. I've got some investigation on what could be a reason.

That definitely happens because of the WM_CLASS property of the window set by Chrome. That's the property the window grouping is based on.

Even though the Desktop entry sets the StartupWMClass to a unique value (different from Chrome windows), Chrome sets it back to google-chrome. And even if we explicitly pass the --class="any-unique-id" command line arg, it will be ignored. There's 9-years-old open issue regarding that I've found in the Chromium bug tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=118613 Although it seems to be working with --user-data-dir or --profile-directory, it's actually not. That's only because windows for different profiles will get different WM_CLASS assigned by Chrome naturally to support the separation of profiles. But for the same profile, the PWA and the browser windows will still be merged into a single group.

I also see some specific logic in DockbarX for the Chromium and --app arg: https://github.com/M7S/dockbarx/blob/ca784021a555ea28cf51985e70e17ee95dd2f4eb/dockbarx/dockbar.py#L1409-L1410 There are a few more places like that in the code. I'm not 100% sure but it looks like a workaround for this issue. Despite that, these chromium-browser and chrome-browser identifiers recognition seem to support Chromium only, but not Google Chrome as it's google-chrome currently.

So I think either the Chrome WM_CLASS setting should be fixed or the DockbarX should handle Google Chrome windows specifically.

insolite commented 2 years ago

I tried adding google-chrome to the lists along with chromium-browser, chrome-browser in DockbarX. Unfortunately, that didn't work.

xuzhen commented 2 years ago

I've fixed this issue in most use cases. As long as the *.desktop launcher file exists under the XDG application directory, the icon will be displayed correctly. The current supported browsers are Chrome/Chromium, MS Edge, Vivaldi and Brave. For Brave, the launcher file has to be created manually at the moment.