You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
All PWAs in the same profile are merged with the first PWA that was opened (Linux Wayland-only) #80
All PWAs are merged with the first PWA that was opened. This only applies to Linux.
When some PWA is already running, all newly launched PWAs will merge with it and remain merged until all of them are closed. This will cause the app menu to display all PWAs as part of the first PWA that was launched, with its icon and desktop actions (if any).
Users can prevent this by installing each PWA into a different profile.
Steps to Reproduce
Install at least two different PWAs into the same profile.
Launch the first PWA.
See that it has the correct icon.
Launch another PWA without closing the first one.
See that is merged with the first one and has the wrong icon.
Possible Solution
This cannot be fixed easily. The native part of the project currently launches Firefox with the --class argument, which should set the WM_CLASS property of the window to the PWA ID. However, because all Firefox processes in the same profile are connected together, all windows have WM_CLASS of the first PWA. Fixing this would probably require modifying Firefox C++ code. Check this comment and related discussions for ideas and possible solutions to fix this.
Reacted by Mark, MS_Y, Stéphane Travostino, l4kr, Bloo Alien, Calum Lind, lena, jemtman and ⁂ Tommi
changed the title [-]All PWAs are merged with the first PWA that was opened (Linux-only, same profile)[/-][+]All PWAs in the same profile are merged with the first PWA that was opened (Linux-only)[/+]on Nov 9, 2021
xprop can externally set the WM_CLASS of the window after it was created w/o modifying the Firefox binary itself. idk what this will do if you have wayland though.
Is it possible to programmatically select the correct Firefox window and then set its WM_CLASS? But then we will still need something similar for Wayland...
Well, maybe the best solution is to report a bug/suggestion to Firefox that --class argument should be respected for each window that is opened, even if they are in the same profile (or to implement another way to make sure windows are not grouped).
That's how I do it manually, the --class / WMCLASS is relative to one profile.
This way some websites have their own icon in OS interface ( icon tasks list, or dock ) detached from the « main » Firefox.
You may eventually synchronize all these PWA profiles with your personal mozilla account ( ie. synchronize only passwords and history. )
Be aware also that native host messaging is not yet implemented in snap and flatpak ( Linux ) packaging.
So for the moment Ubuntu 22.04 users with Firefox as a snap by default won't be able to try your work.
This is how it works for me « manually » ie. not « true » PWA.
Regular Firefox has its legacy launcher :
firefox.desktop
[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
Name[fr]=Navigateur Web Firefox
Comment=Browse the World Wide Web
Comment[fr]=Naviguer sur le Web
GenericName=Web Browser
GenericName[fr]=Navigateur Web
Keywords=Internet;WWW;Browser;Web;Explorer
Keywords[fr]=Internet;WWW;Browser;Web;Explorer;Fureteur;Surfer;Navigateur
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
StartupNotify=true
Actions=new-window;new-private-window;
[Desktop Action new-window]
Name=Open a New Window
Name[fr]=Ouvrir une nouvelle fenêtre
Exec=firefox -new-window
[Desktop Action new-private-window]
Name=Open a New Private Window
Name[fr]=Ouvrir une nouvelle fenêtre de navigation privée
Exec=firefox -private-window
on general level, I'm not sure whether use of Firefox profiles is wise.
E.g. in my personal case, I use Firefox profiles as namespace, i.e. I have separate entities which help me to be in certain context, i.e. personal or one of numerous but particular work (or non-personal) contexts. So there is me (personal profile), work (my tiny company), work for 1 (main client 1), community (my participation in certain community). This way at least different main credential web login (or few) kept intact.
to project into more clear case for you, I may have created PWA links to Google Meet windows, but in one window it will use my personal Gmail account, and all others it will use respective Google Workspace identity per each other profile.
in this context, asking me to create separate profile on each PWA window might be too much. it might be wiser to add in your firefox add-on simple function - besides creation of new profile each time (if you do need it, as you see, I don't), I could re-use existing profiles of Firefox, so I just select existing ones.
not sure what do you mean by that - in context of which code you say 'select'?
After a web app is launched, the code (which launches Firefox runtime here) needs to detect which window has just been opened so it can apply the new WM_CLASS to it.
sorry, but why?
I'm not sure if xprop works properly on Wayland.
on general level, I'm not sure whether use of Firefox profiles is wise.
PWAs will always have to use a different profile system than the main due to how required Firefox modifications are allowed. However, you can still use the same PWA profile on multiple PWAs and replicate your profiles setup for PWAs. When you install a new PWA, just select an existing profile instead of the option to create a new one. The reason that the separate profile for each PWA is default is that because of this issue when you opened multiple PWAs from the same profile at the same time, all of them get merged together in the taskbar.
Hi! This bug appears to be fixed, but the warning when creating a new PWA still appears. Should we still follow the warning, or the writing should be removed as the bug is fixed?
The original problem (merging multiple web apps) has been fixed and the fix has already been released. The warning message has also been updated but this change hasn't been released yet.
However, there is another problem that affects when there are multiple web apps in the same profile (#322). It's a smaller problem and has a workaround (disable "Allow web apps to override a theme (titlebar) color" in the app browser settings). If you do this workaround, it should be fine to install multiple web apps to the same profile.
Reacted by ⁂ Tommi
Reacted by ⁂ Tommi, Blisterexe and Stéphane Travostino
I tested this again, and it appears this issue is still not fixed on Wayland with the MOZ_ENABLE_WAYLAND environment variable (or option "use Wayland Display Server in the extension settings) enabled. It also doesn't work when launching directly from the extension, because then PWAs are still launched in full Wayland mode. However, it works fine in Xwayland mode. I don't remember if I tested full Wayland support back then when I created this fix, so I don't know if this is caused by some recent change in Firefox or GNOME/Wayland or if it has always been like that.
The original fix is implemented in Firefox by using XSetClassHint to set res_name and res_class to FFPWA-ID for each window. The problem is probably that XSetClassHint does not work under Wayland, so we need another way to set a separate "ID" for each window. I've found that gtk addedgdk_wayland_window_set_application_id, which is apparently used in LibreOffice for a similar thing, but I don't know if can work with Firefox.
I might try to use gdk_wayland_window_set_application_id to set the correct ID and submit a patch to Firefox if it works, but I don't know yet when I'll have time (I'm currently working on rewriting some parts of the project, and some other things). Of course, if anyone else can do this, I would appreciate this!
@julian-klode I'm continuing the discussion here because this is the relevant issue for Linux.
changed the title [-]All PWAs in the same profile are merged with the first PWA that was opened (Linux-only)[/-][+]All PWAs in the same profile are merged with the first PWA that was opened (Linux Wayland-only)[/+]on Aug 19, 2023
Activity
[-]All PWAs are merged with the first PWA that was opened (Linux-only, same profile)[/-][+]All PWAs in the same profile are merged with the first PWA that was opened (Linux-only)[/+]alchzh commentedon Dec 1, 2021
xpropcan externally set the WM_CLASS of the window after it was created w/o modifying the Firefox binary itself. idk what this will do if you have wayland though.filips123 commentedon Dec 4, 2021
Is it possible to programmatically select the correct Firefox window and then set its WM_CLASS? But then we will still need something similar for Wayland...
Well, maybe the best solution is to report a bug/suggestion to Firefox that
--classargument should be respected for each window that is opened, even if they are in the same profile (or to implement another way to make sure windows are not grouped).filips123 commentedon Dec 27, 2021
I created a bug on Bugzilla. Feel free to upvote or comment if you have any useful info, but please don't spam it with unnecessary comments.
Coeur-Noir commentedon Jun 20, 2022
Hi,
Have a different firefox profile for each PWA ?
That's how I do it manually, the --class / WMCLASS is relative to one profile.
This way some websites have their own icon in OS interface ( icon tasks list, or dock ) detached from the « main » Firefox.
You may eventually synchronize all these PWA profiles with your personal mozilla account ( ie. synchronize only passwords and history. )
You may look at https://github.com/linuxmint/webapp-manager which also aims at PWA.
Be aware also that native host messaging is not yet implemented in snap and flatpak ( Linux ) packaging.
So for the moment Ubuntu 22.04 users with Firefox as a snap by default won't be able to try your work.
filips123 commentedon Jun 20, 2022
A different PWA Firefox profile for each PWA (PWAsForFirefox uses a separate profile system but in the end result is the same).
When installing a PWA, you need to create a new profile and assign PWA to it:

Coeur-Noir commentedon Jun 20, 2022
Hi,
This is how it works for me « manually » ie. not « true » PWA.
Regular Firefox has its legacy launcher :
Deezer has its own :
and Google Drive another one :
Firefox profile contains :
and profiles.ini contains :
In launchers, mind the Exec and StartupWMClass entries :
In profiles.ini, mind the naming of each Firefox profile, the same wording for each matters.
If placed into
~/.local/share/applicationsthe desktop files make those websites appear in the « app menu » as « regular » app's.All these give me for years visually « separate » instances of Firefox for some websites I prefer to keep aside the main Firefox.
Ubuntu here, can't say about Windows nor Mac, sorry.
silpol commentedon Dec 6, 2022
not sure what do you mean by that - in context of which code you say 'select'?
as you were hinted above, xprop code is good candidate how to manipulate WM_CLASS , i.e. how to get and how to set
you may take a look for :
sorry, but why?
silpol commentedon Dec 6, 2022
on general level, I'm not sure whether use of Firefox profiles is wise.
E.g. in my personal case, I use Firefox profiles as namespace, i.e. I have separate entities which help me to be in certain context, i.e. personal or one of numerous but particular work (or non-personal) contexts. So there is me (personal profile), work (my tiny company), work for 1 (main client 1), community (my participation in certain community). This way at least different main credential web login (or few) kept intact.
to project into more clear case for you, I may have created PWA links to Google Meet windows, but in one window it will use my personal Gmail account, and all others it will use respective Google Workspace identity per each other profile.
in this context, asking me to create separate profile on each PWA window might be too much. it might be wiser to add in your firefox add-on simple function - besides creation of new profile each time (if you do need it, as you see, I don't), I could re-use existing profiles of Firefox, so I just select existing ones.
filips123 commentedon Dec 8, 2022
After a web app is launched, the code (which launches Firefox runtime here) needs to detect which window has just been opened so it can apply the new WM_CLASS to it.
I'm not sure if
xpropworks properly on Wayland.PWAs will always have to use a different profile system than the main due to how required Firefox modifications are allowed. However, you can still use the same PWA profile on multiple PWAs and replicate your profiles setup for PWAs. When you install a new PWA, just select an existing profile instead of the option to create a new one. The reason that the separate profile for each PWA is default is that because of this issue when you opened multiple PWAs from the same profile at the same time, all of them get merged together in the taskbar.
Set `windowclass` and `windowname` attributes to prevent grouping dif…
4 remaining items
xplosionmind commentedon May 1, 2023
Hi! This bug appears to be fixed, but the warning when creating a new PWA still appears. Should we still follow the warning, or the writing should be removed as the bug is fixed?
Thanks a lot, @filips123!
filips123 commentedon May 1, 2023
The original problem (merging multiple web apps) has been fixed and the fix has already been released. The warning message has also been updated but this change hasn't been released yet.
However, there is another problem that affects when there are multiple web apps in the same profile (#322). It's a smaller problem and has a workaround (disable "Allow web apps to override a theme (titlebar) color" in the app browser settings). If you do this workaround, it should be fine to install multiple web apps to the same profile.
filips123 commentedon Aug 16, 2023
I tested this again, and it appears this issue is still not fixed on Wayland with the
MOZ_ENABLE_WAYLANDenvironment variable (or option "use Wayland Display Server in the extension settings) enabled. It also doesn't work when launching directly from the extension, because then PWAs are still launched in full Wayland mode. However, it works fine in Xwayland mode. I don't remember if I tested full Wayland support back then when I created this fix, so I don't know if this is caused by some recent change in Firefox or GNOME/Wayland or if it has always been like that.The original fix is implemented in Firefox by using
XSetClassHintto setres_nameandres_classtoFFPWA-IDfor each window. The problem is probably thatXSetClassHintdoes not work under Wayland, so we need another way to set a separate "ID" for each window. I've found that gtk addedgdk_wayland_window_set_application_id, which is apparently used in LibreOffice for a similar thing, but I don't know if can work with Firefox.I might try to use
gdk_wayland_window_set_application_idto set the correct ID and submit a patch to Firefox if it works, but I don't know yet when I'll have time (I'm currently working on rewriting some parts of the project, and some other things). Of course, if anyone else can do this, I would appreciate this!@julian-klode I'm continuing the discussion here because this is the relevant issue for Linux.
julian-klode commentedon Aug 16, 2023
Oh thanks, sorry about the comment in the wrong bug, I didn't see a Linux issue, didn't expect it to be closed I guess :)
[-]All PWAs in the same profile are merged with the first PWA that was opened (Linux-only)[/-][+]All PWAs in the same profile are merged with the first PWA that was opened (Linux Wayland-only)[/+]filips123 commentedon Sep 24, 2023
I submitted a patch to Firefox that should also fix this issue on Wayland.
filips123 commentedon Sep 28, 2023
The patch has been merged and should be available in Firefox 120 (released on 2023-11-21).