sonnyp / Junction

Application/browser chooser
https://flathub.org/apps/re.sonny.Junction
GNU General Public License v3.0
457 stars 28 forks source link

Custom firefox .desktop file in ~/.local/share/applications launching a separate Firefox profile not detected #118

Closed lgp171188 closed 1 year ago

lgp171188 commented 1 year ago

Operating system: Kubuntu 23.04. Firefox: latest version, 113.0.1-1, installed via the Snap package shipping by default in Kubuntu.

In addition to not showing the custom desktop file launcher, it shows duplicates for various other applications as shown in the screenshot below. There should have been a Canonical Firefox entry in the below screenshot but it is missing.

junction_missing_custom_firefox_desktop_launcher

This issue is preventing me from using Junction.

Here is the custom desktop file named canonical-firefox.desktop.

canonical-firefox.desktop ``` [Desktop Action new-private-window] Exec=/snap/bin/firefox --private-window %u -p Canonical --class=Canonical Name=New Private Window [Desktop Action new-window] Exec=/snap/bin/firefox --new-window %u -p Canonical --class=Canonical Name=New Window [Desktop Entry] Name=Canonical Firefox Comment=Browse the World Wide Web GenericName=Web Browser Type=Application Exec=env BAMF_DESKTOP_FILE_HINT=/home/guruprasad/.local/share/applications/canonical-firefox.desktop /snap/bin/firefox %u -P Canonical --class=Canonical Icon=/home/guruprasad/.local/share/icons/canonical.png Keywords=Internet;WWW;Browser;Web;Explorer 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; NoDisplay=false Path[$e]= StartupNotify=true StartupWMClass=Canonical Terminal=0 TerminalOptions= Version=1.0 X-KDE-SubstituteUID=false X-KDE-Username= X-MultipleArgs=false Actions=new-window;new-private-window; ```

The app works as expected and shows the custom browser profile on my wife's laptop running an older version of Kubuntu, 22.04, and having a similar custom desktop launcher for a custom firefox profile.

sonnyp commented 1 year ago

This list isn't really part of Junction and is there for other purposes.

Don't you get the entry in Junction main window? (there can be multiple rows if you have a lot of entries)

sonnyp commented 1 year ago

Make sure to check https://github.com/sonnyp/Junction#troubleshooting too

lgp171188 commented 1 year ago

@sonnyp,

This list isn't really part of Junction and is there for other purposes.

Don't you get the entry in Junction main window? (there can be multiple rows if you have a lot of entries)

This is what I get

junction_test

As you can see, only the firefox icon corresponding to the default profile is shown. The custom Firefox profile has a custom icon and name (as you might have already seen in the .desktop file shared above in this bug report.

If I click the 3 dots, I get the list of applications with a lot of duplicates, that does not have the custom application launcher that I have created and can use without any issues outside of Junction.

I have tried the troubleshooting steps and added the missing text/mml; mime type to the .desktop file already shared in this bug report, ran update-desktop-database ~/.local/share/applications and still I am running into the same issue.

Is there anything else that I can check?

lgp171188 commented 1 year ago

@sonnyp, is there anything that I can do to help investigate this further?

sonnyp commented 1 year ago

You could write detailed steps to reproduce that I can follow/copy paste. With GNOME Boxes to setup the OS.

I will have a look

lgp171188 commented 1 year ago

Thanks @sonnyp! ❤️

Here are the minimal steps to be able to reproduce this issue.

sonnyp commented 1 year ago

@lgp171188 dunno if it's the issue yet but

update-desktop-database ~/.local/share/applications
Error in file "/home/sonny/.local/share/applications/canonical-firefox.desktop": "    image/gif" is an invalid MIME type ("    image" is an unregistered media type)
sonnyp commented 1 year ago

@lgp171188 could you remove the spaces in MimeType and move the [Desktop Entry] section at the top of the file and try again?

sonnyp commented 1 year ago

The desktop file is invalid indeed

The basic format of the desktop entry file requires that there be a group header named Desktop Entry. There may be other groups present in the file, but this is the most important group which explicitly needs to be supported. This group should also be used as the "magic key" for automatic MIME type detection. There should be nothing preceding this group in the desktop entry file but possibly one or more comments.

[Desktop Entry] must be the first section

lgp171188 commented 1 year ago

@sonnyp, thank you for the useful pointers in debugging this.

@lgp171188 could you remove the spaces in MimeType and move the [Desktop Entry] section at the top of the file and try again?

The space in the MimeType entry in the snippet I pasted above was a typo caused by copy-pasting text from a terminal window. The actual .desktop file does not have it.

I moved the [Desktop Entry] section to the top and like magic, Junction picked it up automatically. 🎉 ❤️

I did run update-desktop-database ~/.local/share/applications now and before reporting this issue and it never complained about the location of the [Desktop Entry] section in the file. This is strange considering that the specification requires it to be the first section in the file.

Thanks again for making an awesome application and your help in resolving this issue!