I was wondering if anyone else has encountered the same issue as I have. I know how I would approach this if Akregator was installed on the system rather than as a flatpak, I would just change the command run by the app when opening in an external browser to flatpak run org.mozilla.firefox about:reader?url=%u which just appends the about:reader portion to automatically open it as such. This command does work from my terminal but naturally does not work with Akregator.

Any help would be greatly appreciated!

  • aurtzy@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    0
    ·
    9 months ago

    Thanks for posting about this! I never thought to try this as an Akregator user, but it’s a great idea… I spent the past day getting this to work since I also use the Flatpaks; hope it helps.

    As suggested by @progandy@feddit.de, one solution is to define a custom protocol where the URL gets passed to a script that opens Firefox Reader with the URL; here’s what I’ve done:

    1. Decide on a protocol name, which the URL will be prefixed with and passed to xdg-open since that should be available to the Flatpak. I used firefox-reader as the protocol, so I put xdg-open firefox-reader://%u as the custom command (so a command Akregator would run might look like xdg-open firefox-reader://https://example.com).
    2. Define a desktop entry to support the custom protocol (you can see mine below). ~/.local/share/applications is the standard place to put these, as far as I’m aware. Since the custom protocol needs to be removed from the URL, I wrote a script (also below) to do this and then call Firefox with about:reader?url= prefixed. The script can be anywhere in $PATH.
    3. Add the desktop entry as a “default application” for opening URLs using this custom protocol. In my case, I ran xdg-mime default org.mozilla.firefox.reader.desktop x-scheme-handler/firefox-reader (org.mozilla.firefox.reader.desktop is the name of my desktop entry file).
    4. You also might have to update some mime/xdg database stuff. I had to run update-desktop-database ~/.local/share/applications so xdg-open would find the “Firefox Reader” desktop entry.
    My Firefox Reader desktop entry
    [Desktop Entry]
    Type=Application
    Name=Firefox Reader
    Exec=open-firefox-reader.sh %u
    StartupNotify=false
    MimeType=x-scheme-handler/firefox-reader;
    
    open-firefox-reader.sh script
    #!/usr/bin/env bash
    
    flatpak run --user org.mozilla.firefox about:reader?url="${1#firefox-reader://}"
    

    If you have any other trouble or want to find more information about this since the desktop entry could probably be tweaked, here are the sources of note I used to figure this out (If I forgot a step or two writing this, they should also be present somewhere in there):

    • Whooping_Seal@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      9 months ago

      Thank you for the very thorough reply! For god knows what reason I get this error: error: app/org.mozilla.firefox/x86_64/stable not installed when running the xdg-open firefox-reader command, yet manually running flatpak run --user org.mozilla.firefox about:reader?url=https://example.com works just fine. I’ll have to troubleshoot it when I have a bit more time ;p

      Thanks again for your very thorough write up and the linked articles. Have a good day :)

      Update: It seems like on my system, the --user flag was the issue, removing it made the script function. I am using Fedora Kinoite (Immutable version of KDE Plasma), so perhaps it is just a difference in how flatpak is configured between distros? I’ll have to read into it more later.

      • aurtzy@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        0
        ·
        9 months ago

        Cheers, glad to hear you got it working. I don’t think there’s any problem on your end; all my flatpaks are user-installed as a Guix System user, so it didn’t cross my mind that a habitually-placed --user flag would not work if something was installed system-wide!