Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web apps share icons with browser #103

Closed
Mek101 opened this issue Apr 20, 2021 · 41 comments · Fixed by #272
Closed

Web apps share icons with browser #103

Mek101 opened this issue Apr 20, 2021 · 41 comments · Fixed by #272

Comments

@Mek101
Copy link

Mek101 commented Apr 20, 2021

Schermata da 2021-04-20 23-17-45

As exemplified here, the main Firefox windows and the Youtube webapp share the same "handler", which in practice means that the web app is treated as a normal Firefox window instead of a separated application.

OS Manjaro
GNOME 3.38
Firefox 88 (Flatpak)

Could be related to #100

@tobiasrenkin
Copy link

tobiasrenkin commented Apr 21, 2021

The same thing happens for me with chrome-based apps but not firefox-based apps.

Linux Mint
XFCE 4.14
Chrome 90.0.4430.72 // Firefox 87

@hsbasu
Copy link
Contributor

hsbasu commented May 1, 2021

I also have the same issue on chrome based browsers only. The windows are clubbed under the icon associated to the first opened instance.
Ubuntu Mate 20.04.2
Chrome 90

@Coeur-Noir
Copy link

As a workaround, you may avoid this « shared icon » using isolated profile for each web-app.

@nicolashainaux
Copy link

... isolated profile for each web-app.

@Coeur-Noir How do you do that?

@Coeur-Noir
Copy link

webapp_isolated

@Mek101
Copy link
Author

Mek101 commented Oct 13, 2021

As a workaround, you may avoid this « shared icon » using isolated profile for each web-app.

This only works on chromium browsers, since Firefox profiles are always isoleted

@nicolashainaux
Copy link

As a workaround, you may avoid this « shared icon » using isolated profile for each web-app.

This only works on chromium browsers, since Firefox profiles are always isoleted

OK, that's why I didn't see the option.

@hsbasu
Copy link
Contributor

hsbasu commented Oct 13, 2021

FYI, separate icon for firefox-based webapps is already fixed with PR #49

@Coeur-Noir
Copy link

⋅ isolated profile choice is only given with chromium based web-browser hence
[ Chromium ( chromium browser ]
in the picture.
⋅ Firefox webapps are isolated by default.

@Mek101
Copy link
Author

Mek101 commented Oct 15, 2021

FYI, separate icon for firefox-based webapps is already fixed with PR #49

Doesn't work on gnome. It highlights as active the youtube app for a second, then as soon as the window appears it switches to the firefox icon.

It not influenced by whatever firefox is already launched or not

@Mek101
Copy link
Author

Mek101 commented Oct 15, 2021

According to looking glass, the youtube app has the wm class firefox and the org.mozilla.firefox app, like the browser

@winiciuscota
Copy link

Is there any other workaround for chrome-based that doesn't involve using isolated profiles? one might have multiple google apps(gmail, spreadsheets, maps) and doesn't want to have multiple login instances fore each one of them, which could also be considered a suspicious behavior by google

@bdombro
Copy link

bdombro commented Jan 7, 2022

I'm on Majaro and have this problem with both Firefox and ungoogled-chrome (flatpak). I got it working by installing ungoogled-chrome from AUR (aka community repo aka NOT flatpak) and checking "isolated profile"

@Khraut
Copy link

Khraut commented Feb 5, 2022

I found a workaround for this problem. It has really annoyed me on me on Manjaro-Gnome (switched from Plasma to Gnome, in Plasma this issue did not exist).

I played around with the .deskop files in /home/.local/share/applications/ and found a really easy fix for this (at least i hope so, i don't know if there are any problems with this way of fixing, at first glance, there is only one drawback).

So here is the fix which worked for me:

  1. create your WebApp with the WebApp-Manager

  2. go to home/.local/share/applications and find the matching .desktop file

  3. open this file with an editor

  4. append this at the end of the line which starts with "Exec" --name=yourWebApp
    so that it looks something like this:
    Exec=sh -c 'XAPP_FORCE_GTKWINDOW_ICON=discord firefox .......... --name=discord'

  5. change the parameters of the lines which start with "Icon" and "StartupWMClass" to yourWebApp
    in this example it would look like this:
    Icon=discord
    StartupWMClass=discord

  6. save the changes

Done!

So as i wrote earlier there is also one known downside of this workaround, the WebApp-Manager does not show the changed WebApps anymore.

So if you want to delete the changed WebApps you have to delete the .desktop files and the profile folders found in home/.local/ice/firefox but i think this is still a good deal.

I hope this helps and i also hope this is the only downside of this, since I am far from being an expert, I can not estimate this exactly.

edit: I don't use Chromium based Browsers so this workaround was only done with Firefox. Maybe this also works for Chromium based Browsers.

@bdombro
Copy link

bdombro commented Feb 5, 2022

Update: My method didn't work because the icon would be shared in the dock if you had multiple apps open.

I also tried @Khraut 's method which almost worked, except it had an issue with following links outside of the initial domain. For example, if creating an app for Fastmail, Reddit, FB Messenger, when someone sends a link in a message and I click it, I would expect the link to be opened in a new browser window. Instead, the webapp opens the link and now it's stuck.

I found a solution which works well for me:

  1. nativefier - a nodejs app that packages any website into an electron app
  2. A script I wrote which installs the electron app into gnome

Src: https://github.com/bdombro/nativefier-linux

@Khraut
Copy link

Khraut commented Feb 6, 2022

@bdombro
I also encountered the issue that there is no new browser windows that opens up when you are clicking on a link inside the webapp. I fixed this with going to the Firefox settings inside the webapp and unchecking the "Open links in tabs instead of new windows" option. Now the link will open up a new window, sadly this window is not like your regular browser window (it shows without address-bar) but for me this is not that big of a problem.

I also found this python script on GitHub: https://github.com/marten-de-vries/mozapp

It seems to also be able to generate webapps that does not share their icon with the browser. But i don't know how these behave on this issue.

@bkmo
Copy link

bkmo commented Jul 18, 2022

If I add --name (same as classname) to the exec= of the .desktop file, then I get a separate entry on the taskbar in KDE with the proper icon. It is now not grouped into the firefox browser. I noticed this from checking out what the python script on GitHub: https://github.com/marten-de-vries/mozapp does as linked by Khraut above.

@Coeur-Noir
Copy link

@bkmo same as here filips123/PWAsForFirefox#80 (comment) maybe ?

@bkmo
Copy link

bkmo commented Jul 18, 2022

This should fix Firefox grouping all webapps in the taskbar.

All I am suggesting is adding is a new parameter "--name (same as --class )" to the exec line of the .desktop file. This could be added at app creation time from the webapp-manager. It seems --name has to be the same as --class in order to get the proper taskbar icon.

I am adding this to the Exec= of the .desktop entries ex: --name WebApp-SpeedtestnetOokla7220 Same as --class

I was able to add it easily to /usr/lib/webapp-manager/common.py

add " --name WebApp-" + codename + after line 216 for Firefox and also after line 233 for inclusion in Librewolf flatpak.
also removing line 185 browsers.append(Browser(BROWSER_TYPE_FALKON, "Falkon", "falkon", "/usr/bin/falkon")) will remove it from the browser dropdown list as it is non functional as a webapp browser (at least the latest version)

@bkmo
Copy link

bkmo commented Jul 19, 2022

I have created a PR 19570c8 for this. It works fine in my setup. Arch Linux, KDE Plasma 5.25, Firefox 102

@Coeur-Noir
Copy link

Ok, ok, I was not saying you're wrong in any way ;-)

I just wonder why I don't need to add --name in my situation.

My « Exec= » lines look like :

Exec=firefox --new-window -P Deezer https://www.deezer.com/fr/ --class Deezer %u

I guess -P « calling » the name of a profile is quite the same as --name ? ? ?

In launchers, mind the Exec and StartupWMClass entries :

  • --new-window
  • -P
  • --class
  • %u ( not sure if it's mandatory )

In profiles.ini, mind the naming of each Firefox profile, the same wording for each matters.
The name of a profile must match the part after the dot in path

[Profile2]
Name=Deezer
IsRelative=1
Path=dj4ng0.Deezer

@bkmo
Copy link

bkmo commented Jul 19, 2022

Are you saying webapp-manager currently works properly by placing each app seperately in the tray? Mine does not. It also does not use current default profiles in Firefox, therefore no profiles.ini. My solution works by simply adding the --name parameter to the Exec= of the .desktop file. Try it! Are you actually using webapp-manager or your own custom profile solution?

@Coeur-Noir
Copy link

It also does not use current default profiles in Firefox, therefore no profiles.ini
You certainly have a profiles.ini in .mozilla/firefox but indeed browser's profiles used by web-app-manager are ( were ? ) stored into ~/.local/share/ice/firefox
Therefore the Exec path should probably mention the full path to the needed profile, something like

--profile /path/to/.local/share/ice/firefox/one_of_your_webapp

hence then

Exec=firefox --new-window --profile /path/to/.local/share/ice/firefox/YourWebApp https://www.website.com/ --class YourWebApp %u

might be enough ( I still have to understand what --new-window, --no-remote or --new-instance are supposed to change here - but in my situation --new-window is enough to have different icons for different websites, surprisingly. )

The icon is tied to a ( browser's ) profile.

I did use ice web app ( from peppermint OS ) then web-app-manager for years, but no longer today as I can't make it work on my Ubuntu 22.04 - don't know why though.

@hsbasu
Copy link
Contributor

hsbasu commented Jul 26, 2022

I did use ice web app ( from peppermint OS ) then web-app-manager for years, but no longer today as I can't make it work on my Ubuntu 22.04 - don't know why though.

Ubuntu 22.04 uses snap version of firefox. That's why it is not working. Here I am providing the quick fix.

Step 1. If you have created a web-app based on firefox for gitlab.com, it's profile would be located in ~/.local/share/ice/firefox. Copy this to ~/snap/firefox/common/.mozilla/firefox.

Step 2. Modify the .desktop file. In the Exec line you would have something like

Exec=sh -c 'XAPP_FORCE_GTKWINDOW_ICON=~/.local/share/ice/icons/GitLab.png firefox --class WebApp-GitLab3098 --profile ~/.local/share/ice/firefox/GitLab3098 --no-remote http://www.gitlab.com'

Change the path after --profile to

Exec=sh -c 'XAPP_FORCE_GTKWINDOW_ICON=~/.local/share/ice/icons/GitLab.png firefox --class WebApp-GitLab3098 --profile ~/snap/firefox/common/.mozilla/firefox/GitLab3098 --no-remote http://www.gitlab.com'

Note: I have have changed my home directory with ~, but in the .desktop files it should be replaced with /home/<username>

As I already said, the whole bug is due to the fact that Ubuntu has dropped the apt version of firefox and webapp-manager does not support snap version of firefox yet.

@Coeur-Noir
Copy link

@hsbasu thanks for caring but I'm not the one asking for help ;-) And you're right about the --profile path in case of a snap, it should be located somewhere inside /home/<user>/snap/firefox/…

I don't use Firefox as a snap in my Ubuntu 22.04, it's a manual installation from https://www.mozilla.org/en-US/firefox/all/#product-desktop-release, so here it's the expected and legacy paths inside $HOME.

Regarding WebApp Manager in Ubuntu 22.04, as stated here https://www.omgubuntu.co.uk/2022/07/install-linux-mint-apps-on-ubuntu-ppa « the Webapp Manager tool (…) did NOT work with the Firefox Snap on my system. »

And I can confirm it also does not work as expected with my « manual installation » : the WebApp opens without title-bar, even if I set Firefox to use a title-bar, making it very uncomfortable to manage its window. ( Here I suspect something related to Wayland or gtk4 and the script that modifies the Firefox interface. )

@hsbasu
Copy link
Contributor

hsbasu commented Jul 26, 2022

I am really sorry. I forgot that ubuntu by default uses Gnome desktop. Thanks for reminding. And I am using Cinnamon. I also have Gnome. I'll check what happens there.

@renatofrota
Copy link

renatofrota commented Sep 1, 2023

Firefox webapps uses proper icon as set for them. The generated .desktop has:

Exec=sh -c 'XAPP_FORCE_GTKWINDOW_ICON=web-whatsapp firefox --class WebApp-WhatsApp6785 --profile /home/avell/.local/share/ice/firefox/WhatsApp6785 --no-remote https://web.whatsapp.com'

Google Chrome webapps are showing Google Chrome's icon. The generated .desktop uses no XAPP_FORCE_GTKWINDOW_ICON.

Editing Google Chrome's one to be like the Firefox's (with XAPP_FORCE_GTKWINDOW_ICON), kinda works but... all windows of Google Chrome will use the same icon as the 1st launched app.

  • Launch WhatsApp web -> WhatsApp icon
  • Launch Google Chrome -> WhatsApp icon

Although I can't explain why it works for Firefox, I suspect it may have some relation to this this commit: linuxmint/xapp@ccc70e5

Any thoughts?

-edit-

I've found it is easier to use native Google Chrome function, right top menu > more tools > create shortcut (tick option to open in a window). The launcher will properly use the website icon and won't stack over the regular Google Chrome icon in taskbar.

The only drawback is: for websites with a PWA manifest, you can't set a custom URL (the launcher will use the one set as default in manifest, forcedly).

@digitalextremist
Copy link

digitalextremist commented Sep 15, 2023

Joining this existing issue for the problem I have been seeing too: "Shared icon in window lists"

I have several Mint 21.x Cinnamon instances with this issue. Are we to the point of having an official approach here, or is this not going to be addressed with a change to the GUI? Seems like all options are workarounds, and all involve manual steps which might regress if you then use the GUI again later?

Regardless of the annoyance of this issue, it is cool to see how properly organized you all are, and how long-suffering. This ticket being started in 2021 Q2 makes it seem like a good candidate for closure :) Let's get this one off the to-do list!


Is this solution viable? #103 (comment)

Is there an equivalent for Chromium browsers that can be added to the PR? Going to mess with this on a fork.

@digitalextremist
Copy link

digitalextremist commented Sep 22, 2023

Since my last post, I tried the @bdombro suggestion: #103 (comment) ...

Nativefier https://github.com/bdombro/nativefier-linux

I already had npm installed, so I ran the nativefier package install, and tried it out. Definitely solves the problem, but goes further and allows addition of systray icon for web app, single-instance protection, always on top, etc... if desired, by build flag.

Also it remembers the location of the window between sessions. Web App manager usually started all windows in the left half of the entire screen on the primary display every time, and never remembered otherwise.

Is each native executable >200MB? Well, yes... the browser is packaged with each Electron instance, per overkill usual. But at least now it works while/if Web App manager evolves. Will check back in a year or so :)

Thanks @bdombro

@digitalextremist
Copy link

Oh man. So, using nativefier is great, except for huge issue: No ad-blocker support whatsoever, with no hope of that in sight. In the case of internal systems that might be fine, but even if you are using it just for webmail for example, that is going to be riddled with ads very often. And the support for ad-blocking seems to be either dead, or up 💩 creek without a paddle.

nativefier/nativefier#1532

@jberlyn
Copy link

jberlyn commented Oct 28, 2023

I am experiencing something similar on Arch Linux with KDE Plasma 5.27.9 and Wayland. When the app first opens, the correct icon is shown in the taskbar, but then is collapsed into the Firefox icon. The app is also showing as Firefox in the overview window or task switcher (ALT+TAB). This does not happen under X11.

@nuovodna
Copy link

nuovodna commented Oct 30, 2023

same here, Fedora 39 + Gnome 45.
Web WhatsApp shows Firefox icon in task switcher (not in launcher), Chromium version shows fallback icon

@saschaeggi
Copy link
Contributor

saschaeggi commented Oct 31, 2023

Same here Fedora 38 + Gnome 44

WebApps created with Firefox all show up as Firefox and not as individual Apps.
When choosing Chrome it starts as separate App but the window size gets reseted very single time the App starts.

@saschaeggi
Copy link
Contributor

I can confirm that just adding --name WebApp-[NAMEHERE] actually solves the problem under Wayland.

Tested on Fedora 38 + Gnome 44 / Fedora 39 + Gnome 45

@saschaeggi
Copy link
Contributor

I've created a MR with a fix: #272

@digitalextremist
Copy link

@clefebvre and @saschaeggi does this fix require Wayland to enjoy?

@saschaeggi
Copy link
Contributor

@digitalextremist the related MR fixes the window handling in wayland

@tobiasrenkin
Copy link

tobiasrenkin commented Nov 29, 2023

@saschaeggi perhaps it is a bit early to close the bug then, given that it was originally reported for x ?

@saschaeggi
Copy link
Contributor

@tobiasrenkin I leave this decision to the maintainer. Have you tested if this also fixes your issue in X11?

@jberlyn
Copy link

jberlyn commented Dec 7, 2023

Thanks for the fix @saschaeggi, it is appearing in my taskbar on KDE Plasma correctly now. However it still appears incorrectly in the Overview screen, as well as the window title bar.

Overview screen
image

Window titlebar
image

@Th3Rom3
Copy link

Th3Rom3 commented Dec 28, 2023

I can second this observation for KDE Plasma 5.27.9 on Wayland. Task-Manager icon displays correctly now. Window title and Overview show the default Wayland icon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.