filips123 / PWAsForFirefox

A tool to install, manage and use Progressive Web Apps (PWAs) in Mozilla Firefox
https://pwasforfirefox.filips.si
Mozilla Public License 2.0
2.15k stars 50 forks source link

[SUGGESTION] Enable PWA Rename #521

Closed influential-eliot closed 1 month ago

influential-eliot commented 1 month ago

Description

Essentially, if you change the StartupWMClass in the .desktop entry for the PWA, it means destroys whatever icon is set for the app.

This isn't the problem, here, but it is a symptom of something I would assume that one should be able to do.

My very limited understanding of this setting (I'm a noob, but I'm all in on Debian) is that essentially it allows the OS / Wayland / Gnome3 / Whatever(!) to keep windows of the same application together.

Proposed Solution

Start to build an 'options' setup in the parent profile on Firefox, to allow limited management of the various PWAs that have been created.

There you could manage things like this.

Additional Information

For things like this it would allow users an obvious place to go to manage the app name. Meaning that instead of getting notifications from FFPWA-01HYN9Z91NXAQ87QZDIUTT331A one might actually see them from SLACK, or Teams, perhaps. :)

filips123 commented 1 month ago

I don't really know what do you mean here. You are correct in that StartupWMClass is the ID that helps the desktop environment associate windows with the correct application. However, it is only an internal ID and shouldn't be seen by the user. If you want to rename PWAs, you should do this from the extension, which affects the Name key inside the desktop entry, which is the one that should be displayed by the DE.

influential-eliot commented 1 month ago

OK, well ... in that case this might need to be converted to an incident. :(

Because:

  1. There are zero options to do anything with any of the PWAs that have been made
  2. Whenever I change the StartupWMClass icons disappear from the dock / applications menu

This is not true of other applications.

EDIT - I should also note that I cannot see any of the profiles created for the PWAs ... is there a chance that something got corrupted in the profile arena of FF?


Details

Here's what my pwaSlack.desktop currently looks like:

[Desktop Entry]
Type=Application
Version=1.4
Name=SLACK
Comment=
Keywords=;
Categories=GTK;WebApps;Chat;Network;
##old icon=FFPWA-01HYB3NYVPZP7T5PJQYCCZ4EPM
Icon=pwaSlack
Exec=/usr/bin/firefoxpwa site launch 01HYB3NYVPZP7T5PJQYCCZ4EPM --protocol %u
Actions=
MimeType=x-scheme-handler/pwaslack;
Terminal=false
StartupNotify=true
StartupWMClass=FFPWA-01HYB3NYVPZP7T5PJQYCCZ4EPM

If that is changed to the below, then the icons disappear.

[Desktop Entry]
Type=Application
Version=1.4
Name=SLACK
Comment=
Keywords=;
Categories=GTK;WebApps;Chat;Network;
##old icon=FFPWA-01HYB3NYVPZP7T5PJQYCCZ4EPM
Icon=pwaSlack
Exec=/usr/bin/firefoxpwa site launch 01HYB3NYVPZP7T5PJQYCCZ4EPM --protocol %u
Actions=
MimeType=x-scheme-handler/pwaslack;
Terminal=false
StartupNotify=true
##old StartupWMClass=FFPWA-01HYB3NYVPZP7T5PJQYCCZ4EPM
StartupWMClass=pwaSlack

I see this literally in front of my eyes.

Additional Info

System Info

Icon Storage

The pwaSlack.svg icon is in the following locations:

1.~/.icons

  1. ~/.local/share/applications
  2. /usr/share/icons/gnome/scalable/mimetypes

Other Apps Affected

This occurs with all apps made from the PWA extension.

Non-pwa apps are fine, for example seamonkey, which I installed and changed both icon and wmstartupclass yesterday.

influential-eliot commented 1 month ago

OK, I think I'm perhaps seeing something that might be related to the issue, here. Something weird has happened with the versions of Firefox installed on this Debian instance.

I run Nightly as my default browser, currently at version vers with (apart from the oddity that is additional unused profiles) one usable profile.

Once I noted that I could install the PWA application, I installed *standard* Firefox (had meant to install ESR, but still) and can't remember if I made a profile specifically for the making of PWAs, but either way, went ahead. This is from the debian repo, not snap/flatpak.

I added the PWA extension, and PWAs for Outlook, SLACK, and Teams.


Now ... I've just now opened about:profiles in standard Firefox and it is showing a whole bunch of profiles. But a couple won't actually open in Firefox saying 'old browser' or something.

The Standard Firefox is 127.0.2 (64-bit) ... and Nightly is 130.0a1 currently.

I think that somewhere along the line the Nightly instance has taken over the profiles.

Checking the compatibility.ini for some of them somewhat backs all of that up as nightly is been listed as the browser in the profile I believe is the one assigned to make the PWAs.

That profile was not created in Nightly and the PWAs do not launch using the Nightly binary, they use the ~/.local/share/firefoxpwa/runtime/firefox-bin binary and are running on 127.0.2 not the nightly 130.0a1 version in the /usr/lib/firefox-nightly/firefox-bin location.


Not really sure what any of that means ... but ... yeah ... perhaps I can just 'rescue' that profile by amending the compatibility.ini ... I dunno.

influential-eliot commented 1 month ago

Rescuing the compatibility.ini works to get it to open in the right browser, but still ... renaming the application is only doable at a surface level.

One cannot change the ID of the PWA in the PWA extension, it's read only. So renaming there will really do nothing for my ability to affect change at the StartupWMClass level ...

Like, I cannot change the Teams PWA ID to pwaTeams ...


Also, I've just attempted to edit a PWA (outlook) in the application, and it gave this error:

Failed to update web app manifest: Failed to parse web app manifest: expected value at line 1 column 1

I am wondering if that is because I have edited and renamed the original .desktop file it had made.

filips123 commented 1 month ago

Sorry for the late reply...

I should also note that I cannot see any of the profiles created for the PWAs ... is there a chance that something got corrupted in the profile arena of FF?

PWAsForFirefox uses a separate profile system from the rest of Firefox. Profiles are stored in a separate directory and shouldn't appear in about:profiles.

Once I noted that I could install the PWA application, I installed *standard* Firefox (had meant to install ESR, but still) and can't remember if I made a profile specifically for the making of PWAs, but either way, went ahead. This is from the debian repo, not snap/flatpak.

You don't need to create a specific profile in normal Firefox for PWAs. All PWA profiles are managed directly by PWAsForFirefox. You also don't have to install a separate Firefox version instead, as the internal Firefox runtime will be downloaded automatically to the correct directory.

I think that somewhere along the line the Nightly instance has taken over the profiles.

Maybe Nightly created those directories? But I think this isn't reklated to PWAsForFirefox.

One cannot change the ID of the PWA in the PWA extension, it's read only. So renaming there will really do nothing for my ability to affect change at the StartupWMClass level ...

Well, but why do you want to change the ID and StartupWMClass in the first place? It's only internal ID, autogenerated and it's intentional that it can't be changed...

influential-eliot commented 1 month ago

I just wanted control over the ID of the application, the windows, and suchlike.

So, if I wanted to have something else open within that context I could. (I think) ... Again, I'm still a bit of a newb, but I think I'm in the right realms of thinking, here.

Either way, you can close this if you like ... I just think that having a bit more control over the ID of the applications would allow folks to reference those more easily ... instead of some odd GUID. Just my two pennies. :)

influential-eliot commented 1 month ago

One thing I thought to ask (but didn't think was worth raising a whole new ticket, so no probs if you don't see this) ... is there anything wrong with placing the application links inside /usr/share/applications instead of my ~/.local ... ... perhaps with user specific permissions to the .desktop file or something?

That way these PWAs can be pinned to the dashboard and not open as a separate icon when open. :)

EDIT - It'd seem not ... but I either have to control heavily who uses this machine (should only ever be me) and/or look into it a bit more from a security perspective.

filips123 commented 1 month ago

I think you should be able to symlink .desktop files from ~/.local to /usr/share/applications, but maybe you will have to change permissions a bit.

influential-eliot commented 1 month ago

Cheers, yeah ... I'd read that symlinks don't keep additional windows in the same tray area, but I'll have a play. Cheers, @filips123 ! :)