sonnyp/Junction

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

lgp171188 opened this issue · 10 comments

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.

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,

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?

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

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

Thanks @sonnyp! ❤️

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

  • Create a virtual machine in GNOME Boxes with at least 4 GiB RAM, 10 GiB hard disk space, and 2 or more vCPUs.

  • Download the latest Kubuntu 23.04 64-bit ISO image from https://kubuntu.org/getkubuntu/

  • Verify the checksums after download.

  • Mount the ISO on the GNOME Boxes VM created in the first step.

  • Boot into the Kubuntu Live environment and install it using the Kubuntu installer. Use the defaults for partitioning .

  • Reboot after the installation is completed. Eject the installation medium.

  • Boot into the installed Kubuntu 23.04 OS.

  • Run the following commands to enable flatpak support.

    sudo apt install flatpak plasma-discover-backend-flatpak
    flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    
  • Install the Junction flatpak.

    flatpak install re.sonny.Junction
    
  • Start Firefox and let it load the default profile. Close it after that.

  • Start the Firefox profile manager by pressing Alt+F2 and then typing firefox -p.

  • Create a new Firefox profile named Canonical. Uncheck the option to always boot into the selected profile.

  • Launch the just-created Canonical Firefox profile and let it load. Close Firefox.

  • Create a custom desktop file named canonical-firefox.desktop at ~/.local/share/applications/canonical-firefox.desktop with the following contents.

    ~/.local/share/applications/canonical-firefox.desktop
    [Desktop Action new-private-window]
    Exec=/usr/bin/firefox --private-window %u -p Canonical --class=Canonical
    Name=New Private Window
    
    [Desktop Action new-window]
    Exec=/usr/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=/usr/bin/firefox %u -P Canonical --class=Canonical
    Keywords=Internet;WWW;Browser;Web;Explorer
    MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;text/mml;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
    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;
  • Save, run update-desktop-database ~/.local/share/applications.
  • Press the Windows key and search for Canonical Firefox. The desktop entry created previously, should show up as an application.
  • Launch that Firefox application. Verify from the about:profiles page that the Canonical profile is the one that is loaded.
  • Close Firefox.
  • Launch Junction.
  • Enable showing the title under the icons.
  • If the custom browser profile is listed by default, click the button with 3 dots. An application picker shows up.
  • Try to find the Canonical Firefox application. It wouldn't be listed.

@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)

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

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

@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!