[snap] PWA don't launch as applications, just another chromium window

Bug #2007652 reported by zwn
60
This bug affects 10 people
Affects Status Importance Assigned to Milestone
chromium-browser (Ubuntu)
Invalid
Medium
Unassigned
gnome-shell (Ubuntu)
Opinion
Medium
Nathan Teodosio

Bug Description

I have recently converted from deb to snap package of chromium and progressive web applications (PWAs) launch just as another window of chromium and are not recognized as separate application by the window manager (for example when switching using Super+Tab) or dock (grouped under chromium windows).

This is either a regression of the snap package vs deb or ubuntu 20.04 vs ubuntu 18.04 (I am not able to differentiate between these two since both happened together).

Tags: snap
description: updated
tags: added: snap
summary: - PWA don't launch as applications, just another chromium window
+ [snap] PWA don't launch as applications, just another chromium window
Revision history for this message
Frederik Feichtmeier (feichtmeier) wrote :

I am also affected by this bug. This is my personal last barrier to switch over to chromium from chrome. As I make heavy use of PWAs for example for microsoft and google products plus community projects like exalidraw.

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

Can give an example for testing?

Changed in chromium-browser (Ubuntu):
status: New → Confirmed
Revision history for this message
zwn (zwn) wrote :

My use case is https://chat.google.com/. It offers to install itself (button in the url bar). When I click it, it opens as top level window without the url bar, but still grouped under the chromium windows - it does not get its own button on the taskbar and Super+Tab does not recognize the chat window as its own application. In both cases the deb version created the feel that the chat is its own thing, separate from chromium.

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

Thanks for providing a reproduction case.

Changed in chromium-browser (Ubuntu):
importance: Undecided → Low
Revision history for this message
Nathan Teodosio (nteodosio) wrote (last edit ): Gnome Shell?

I can verify that in Bionic (with the deb) the application shows in
Gnome's task bar as a separate application, not grouped under Chromium,
and that in Lunar (with the snap) it shows in Gnome's task bar grouped
under the Chromium button.

However,

1. Wmctrl shows that the window classes and names are consistent,

--> Lunar <--
0x01c00003 0 chromium.Chromium
0x01c00011 0 crx_mdpkiolbdkhdjpekf.Chromium

--> Bionic <--
0x01c00003 0 chromium-browser.Chromium-browser
0x01c00019 0 crx_mdpkiolbdkhdjpekf.Chromium-browser

2. The bug is absent from both Unity and Icewm (see attachments).

So I think this is a regression in Gnome Shell from Ubuntu 20.04 vs
Ubuntu 18.04.

Revision history for this message
Nathan Teodosio (nteodosio) wrote :
Changed in chromium-browser (Ubuntu):
importance: Low → Medium
Changed in gnome-shell (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-shell (Ubuntu):
status: New → Confirmed
Revision history for this message
Nathan Teodosio (nteodosio) wrote (last edit ):

The problem is https://forum.snapcraft.io/t/how-to-expose-desktop-files-created-by-snaps-to-the-de.

Probably duplicate of the there mentioned LP:1732482.

I can confirm it is not a problem from Chromium PPA.

no longer affects: gnome-shell (Ubuntu)
Revision history for this message
zwn (zwn) wrote :

I am aware of the problem with desktop files & snaps. Therefore I am launching the installed app directly from Chromium page available at chrome://apps to circumvent the problem (of not being able to pick up the desktop file). That makes me believe that this is not a duplicate of the linked bug since desktop files are not part of the reproducible test case.

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

Thanks for the response, zwm.

The desktop file is necessary for Gnome Shell to categorize the PWA as a different application — in its own tab group — instead of just another Chromium window.

This bug is therefore a particular consequence of Chromium, as a snapped application, not being able create its own desktop files in the canonical paths.

Do you agree with the reasoning?

Revision history for this message
zwn (zwn) wrote :

> The desktop file is necessary for Gnome Shell to categorize the PWA as a different application — in its own tab group — instead of just another Chromium window.

Since I am not familiar with the way how Gnome Shell decides which windows belong together and you don't explain how it is done, it is really hard for me to agree or disagree with anything.

In the comment #5 you mention window classes as a way to do this feat. The desktop file seems like a possible way to launch Chromium with a specific window class which makes it a separate application. Is this a correct deduction?

Is the desktop file the only way to do this? I was under the impression that using "chrome://apps" page as a launcher would be a different way how to launch a new Chromium with the required window class. If this is not the way then the launcher is broken - or at least creates a misplaced expectations (but that would be a different bug). If the launcher is not broken and sets everything correctly, then this bug is not a duplicate of bug #1732482.

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

I'm posting what I've learned so far but there is still much to figure.

> In the comment #5 you mention window classes as a way to do this feat. The desktop file seems like a possible way to launch Chromium with a specific window class which makes it a separate application. Is this a correct deduction?

I messed up when transcribing the output for comment #5. I'm editing it to fix it. Bottom line is: The classes are the same in Bionic/deb as well (as the attached image shows), nonetheless the PWA does fall into a different tab group.

Still in Bionic/deb, if I change StartupWMClass (regardless of matching --app-id) in the desktop file though, then the unwanted behavior (PWA grouped under Chromium) is observed if the application is opened from inside Chromium, whereas trying the launcher itself fails to open the PWA and only opens normal Chromium. So it just knows and needs to be launched with the registered app-id, and Gnome Shell will expect that as its class.

Back to the snap world, same observations apply, except that snap cannot write to the a canonical XDG_DATA_DIR ($HOME/.local/share/applications) and thus Gnome Shell is oblivious.

But if I try

  cp ~/snap/chromium/current/*/*.desktop ~/.local/share/applications

then I **can open the PWA from the dock and it behaves as a separate application indeed**, but not if opened from inside Chromium, and their classes do diverge in the success case:

--->
$ wmctrl -lx #Opened from dock item, different classes
0x01a00020 0 xterm.XTerm canonical xterm
0x01c00003 0 chromium.Chromium canonical Neuer Tab - Chromium
0x02800003 0 crx_mdpkiolbdkhdjpekfbkbmhigcaggjagi.Chromium-browser canonical Google Chat - Chat
$ wmctrl -lx #Opened from inside Chromium, same classes
0x01a00020 0 xterm.XTerm canonical xterm
0x01c00003 0 chromium.Chromium canonical Neuer Tab - Chromium
0x01c00015 0 crx_mdpkiolbdkhdjpekfbkbmhigcaggjagi.Chromium canonical Google Chat - Chat
<---

Also, as noted elsewhere, the path to the executable registered in the desktop file points unfortunately to the unsandboxed binary, namely /snap/chromium/2497/usr/lib/chromium-browser/chrome.

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

With the help of 3v1n0 it's confirmed that this is Mutter interpretation of a sandboxed application.

Whether this is a bug is then a matter of opinion and actually complicated[1].

You may need to convince Gnome maintainers about it or use another desktop environment.

[1] https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/84

Changed in mutter (Ubuntu):
status: New → Opinion
Changed in chromium-browser (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Nathan Teodosio (nteodosio) wrote :

> But if I try
>
> cp ~/snap/chromium/current/*/*.desktop ~/.local/share/applications
>
> then I **can open the PWA from the dock and it behaves as a separate application indeed**, but not if opened from inside Chromium,

Even that small consolation suffered a regression in newer Mutter (testing in 24.10).

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

I think we can just carry a small patch downstream to special-case the Chromium snap.

Can any of you in 24.10 please confirm the fix by installing gnome-shell from this PPA? https://launchpad.net/~nteodosio/+archive/ubuntu/pwa/

Changed in gnome-shell (Ubuntu):
status: New → Opinion
assignee: nobody → Nathan Teodosio (nteodosio)
importance: Undecided → Medium
no longer affects: mutter (Ubuntu)
Revision history for this message
Nathan Teodosio (nteodosio) wrote :

If you are in a different series of Ubuntu and are interested in the proposed fix, tell me and I'll build for that release.

Revision history for this message
Jan Visser (starquake) wrote :

> If you are in a different series of Ubuntu and are interested in the proposed fix, tell me and I'll build for that release.

Yes please. I'm on 24.04 and would love this fix!

Revision history for this message
Nathan Teodosio (nteodosio) wrote : Re: [Bug 2007652] Re: [snap] PWA don't launch as applications, just another chromium window

I submitted a build for 24.04 in that PPA, will be there by the end of the day
if nothing goes wrong.

Revision history for this message
Jan Visser (starquake) wrote (last edit ):

> Can any of you in 24.10 please confirm the fix by installing gnome-shell from this PPA? https://launchpad.net/~nteodosio/+archive/ubuntu/pwa/

I can confirm the fix works for 24.04! Thanks!

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

Glad to hear that, thank you for testing!

Revision history for this message
Jan Visser (starquake) wrote :

No problem! Would I be right to assume that this fix will be included in 24.04 at some point?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.