Brackets code editor can't call Firefox for live preview - Xdg issue?

Anyone using Brackets on Manjaro?
In installed Brackets from Flathub. It is supposed to have support for using other (non-Chrome) browsers with live preview for some years now, but it’s not working for me.
There’s a issue on their Github specifically about the Linux version. It would appear to make a call to Xdg-open to launch Firefox, and I suspect that’s what fails somehow.
One suggested fix is to add executable permission to the shell script that calls Xdg (I think that’s what it does):

The path to that file is different in my Manjaro (bcs Flatpak install and different OS):
/var/lib/flatpak/app/io.brackets.Brackets/x86_64/stable/bf162a9f28d274836fe6a44327d98a57ed01d72d38c0dc946833d4ba1cf7d353/files/www/node_modules/opn/xdg-open
, but adding x permission to it hasn’t helped. so I wonder if there could be a Manjaro specific solution here?

I’m including the script here for convenience (I’m not handy with Bahs script, but maybe someone can see if this does the right things in Manjaro):

#!/bin/sh
#---------------------------------------------
#   xdg-open
#
#   Utility script to open a URL in the registered default application.
#
#   Refer to the usage() function below for usage.
#
#   Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org>
#   Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org>
#   Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
#   Copyright 2006, Jeremy White <jwhite@codeweavers.com>
#
#   LICENSE:
#
#   Permission is hereby granted, free of charge, to any person obtaining a
#   copy of this software and associated documentation files (the "Software"),
#   to deal in the Software without restriction, including without limitation
#   the rights to use, copy, modify, merge, publish, distribute, sublicense,
#   and/or sell copies of the Software, and to permit persons to whom the
#   Software is furnished to do so, subject to the following conditions:
#
#   The above copyright notice and this permission notice shall be included
#   in all copies or substantial portions of the Software.
#
#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
#   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
#   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
#   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
#   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
#   OTHER DEALINGS IN THE SOFTWARE.
#
#---------------------------------------------

manualpage()
{
cat << _MANUALPAGE
Name

   xdg-open - opens a file or URL in the user's preferred
   application

Synopsis

   xdg-open { file | URL }

   xdg-open { --help | --manual | --version }

Description

   xdg-open opens a file or URL in the user's preferred
   application. If a URL is provided the URL will be opened in the
   user's preferred web browser. If a file is provided the file
   will be opened in the preferred application for files of that
   type. xdg-open supports file, ftp, http and https URLs.

   xdg-open is for use inside a desktop session only. It is not
   recommended to use xdg-open as root.

Options

   --help
          Show command synopsis.

   --manual
          Show this manual page.

   --version
          Show the xdg-utils version information.

Exit Codes

   An exit code of 0 indicates success while a non-zero exit code
   indicates failure. The following failure codes can be returned:

   1
          Error in command line syntax.

   2
          One of the files passed on the command line did not
          exist.

   3
          A required tool could not be found.

   4
          The action failed.

Examples

xdg-open 'http://www.freedesktop.org/'

   Opens the freedesktop.org website in the user's default
   browser.

xdg-open /tmp/foobar.png

   Opens the PNG image file /tmp/foobar.png in the user's default
   image viewing application.
_MANUALPAGE
}

usage()
{
cat << _USAGE
   xdg-open - opens a file or URL in the user's preferred
   application

Synopsis

   xdg-open { file | URL }

   xdg-open { --help | --manual | --version }

_USAGE
}

#@xdg-utils-common@

#----------------------------------------------------------------------------
#   Common utility functions included in all XDG wrapper scripts
#----------------------------------------------------------------------------

DEBUG()
{
  [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && return 0;
  [ ${XDG_UTILS_DEBUG_LEVEL} -lt $1 ] && return 0;
  shift
  echo "$@" >&2
}

# This handles backslashes but not quote marks.
first_word()
{
    read first rest
    echo "$first"
}

#-------------------------------------------------------------
# map a binary to a .desktop file
binary_to_desktop_file()
{
    search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
    binary="`which "$1"`"
    binary="`readlink -f "$binary"`"
    base="`basename "$binary"`"
    IFS=:
    for dir in $search; do
        unset IFS
        [ "$dir" ] || continue
        [ -d "$dir/applications" ] || [ -d "$dir/applnk" ] || continue
        for file in "$dir"/applications/*.desktop "$dir"/applications/*/*.desktop "$dir"/applnk/*.desktop "$dir"/applnk/*/*.desktop; do
            [ -r "$file" ] || continue
            # Check to make sure it's worth the processing.
            grep -q "^Exec.*$base" "$file" || continue
            # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop").
            grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue
            command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"
            command="`which "$command"`"
            if [ x"`readlink -f "$command"`" = x"$binary" ]; then
                # Fix any double slashes that got added path composition
                echo "$file" | sed -e 's,//*,/,g'
                return
            fi
        done
    done
}

#-------------------------------------------------------------
# map a .desktop file to a binary
## FIXME: handle vendor dir case
desktop_file_to_binary()
{
    search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
    desktop="`basename "$1"`"
    IFS=:
    for dir in $search; do
        unset IFS
        [ "$dir" ] && [ -d "$dir/applications" ] || continue
        file="$dir/applications/$desktop"
        [ -r "$file" ] || continue
        # Remove any arguments (%F, %f, %U, %u, etc.).
        command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"
        command="`which "$command"`"
        readlink -f "$command"
        return
    done
}

#-------------------------------------------------------------
# Exit script on successfully completing the desired operation

exit_success()
{
    if [ $# -gt 0 ]; then
        echo "$@"
        echo
    fi

    exit 0
}


#-----------------------------------------
# Exit script on malformed arguments, not enough arguments
# or missing required option.
# prints usage information

exit_failure_syntax()
{
    if [ $# -gt 0 ]; then
        echo "xdg-open: $@" >&2
        echo "Try 'xdg-open --help' for more information." >&2
    else
        usage
        echo "Use 'man xdg-open' or 'xdg-open --manual' for additional info."
    fi

    exit 1
}

#-------------------------------------------------------------
# Exit script on missing file specified on command line

exit_failure_file_missing()
{
    if [ $# -gt 0 ]; then
        echo "xdg-open: $@" >&2
    fi

    exit 2
}

#-------------------------------------------------------------
# Exit script on failure to locate necessary tool applications

exit_failure_operation_impossible()
{
    if [ $# -gt 0 ]; then
        echo "xdg-open: $@" >&2
    fi

    exit 3
}

#-------------------------------------------------------------
# Exit script on failure returned by a tool application

exit_failure_operation_failed()
{
    if [ $# -gt 0 ]; then
        echo "xdg-open: $@" >&2
    fi

    exit 4
}

#------------------------------------------------------------
# Exit script on insufficient permission to read a specified file

exit_failure_file_permission_read()
{
    if [ $# -gt 0 ]; then
        echo "xdg-open: $@" >&2
    fi

    exit 5
}

#------------------------------------------------------------
# Exit script on insufficient permission to write a specified file

exit_failure_file_permission_write()
{
    if [ $# -gt 0 ]; then
        echo "xdg-open: $@" >&2
    fi

    exit 6
}

check_input_file()
{
    if [ ! -e "$1" ]; then
        exit_failure_file_missing "file '$1' does not exist"
    fi
    if [ ! -r "$1" ]; then
        exit_failure_file_permission_read "no permission to read file '$1'"
    fi
}

check_vendor_prefix()
{
    file_label="$2"
    [ -n "$file_label" ] || file_label="filename"
    file=`basename "$1"`
    case "$file" in
       [[:alpha:]]*-*)
         return
         ;;
    esac

    echo "xdg-open: $file_label '$file' does not have a proper vendor prefix" >&2
    echo 'A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated' >&2
    echo 'with a dash ("-"). An example '"$file_label"' is '"'example-$file'" >&2
    echo "Use --novendor to override or 'xdg-open --manual' for additional info." >&2
    exit 1
}

check_output_file()
{
    # if the file exists, check if it is writeable
    # if it does not exists, check if we are allowed to write on the directory
    if [ -e "$1" ]; then
        if [ ! -w "$1" ]; then
            exit_failure_file_permission_write "no permission to write to file '$1'"
        fi
    else
        DIR=`dirname "$1"`
        if [ ! -w "$DIR" ] || [ ! -x "$DIR" ]; then
            exit_failure_file_permission_write "no permission to create file '$1'"
        fi
    fi
}

#----------------------------------------
# Checks for shared commands, e.g. --help

check_common_commands()
{
    while [ $# -gt 0 ] ; do
        parm="$1"
        shift

        case "$parm" in
            --help)
            usage
            echo "Use 'man xdg-open' or 'xdg-open --manual' for additional info."
            exit_success
            ;;

            --manual)
            manualpage
            exit_success
            ;;

            --version)
            echo "xdg-open 1.1.0 rc3"
            exit_success
            ;;
        esac
    done
}

check_common_commands "$@"

[ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL;
if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then
    # Be silent
    xdg_redirect_output=" > /dev/null 2> /dev/null"
else
    # All output to stderr
    xdg_redirect_output=" >&2"
fi

#--------------------------------------
# Checks for known desktop environments
# set variable DE to the desktop environments name, lowercase

detectDE()
{
    # see https://bugs.freedesktop.org/show_bug.cgi?id=34164
    unset GREP_OPTIONS

    if [ -n "${XDG_CURRENT_DESKTOP}" ]; then
      case "${XDG_CURRENT_DESKTOP}" in
         ENLIGHTENMENT)
           DE=enlightenment;
           ;;
         GNOME)
           DE=gnome;
           ;;
         KDE)
           DE=kde;
           ;;
         LXDE)
           DE=lxde;
           ;;
         MATE)
           DE=mate;
           ;;
         XFCE)
           DE=xfce
           ;;
      esac
    fi

    if [ x"$DE" = x"" ]; then
      # classic fallbacks
      if [ x"$KDE_FULL_SESSION" != x"" ]; then DE=kde;
      elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
      elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate;
      elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
      elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
      elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>&1; then DE=xfce
      elif echo $DESKTOP | grep -q '^Enlightenment'; then DE=enlightenment;
      fi
    fi

    if [ x"$DE" = x"" ]; then
      # fallback to checking $DESKTOP_SESSION
      case "$DESKTOP_SESSION" in
         gnome)
           DE=gnome;
           ;;
         LXDE|Lubuntu)
           DE=lxde; 
           ;;
         MATE)
           DE=mate;
           ;;
         xfce|xfce4|'Xfce Session')
           DE=xfce;
           ;;
      esac
    fi

    if [ x"$DE" = x"" ]; then
      # fallback to uname output for other platforms
      case "$(uname 2>/dev/null)" in 
        Darwin)
          DE=darwin;
          ;;
      esac
    fi

    if [ x"$DE" = x"gnome" ]; then
      # gnome-default-applications-properties is only available in GNOME 2.x
      # but not in GNOME 3.x
      which gnome-default-applications-properties > /dev/null 2>&1  || DE="gnome3"
    fi
}

#----------------------------------------------------------------------------
# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
# It also always returns 1 in KDE 3.4 and earlier
# Simply return 0 in such case

kfmclient_fix_exit_code()
{
    version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'`
    major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'`
    minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'`
    release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'`
    test "$major" -gt 3 && return $1
    test "$minor" -gt 5 && return $1
    test "$release" -gt 4 && return $1
    return 0
}

# This handles backslashes but not quote marks.
last_word()
{
    read first rest
    echo "$rest"
}

# Get the value of a key in a desktop file's Desktop Entry group.
# Example: Use get_key foo.desktop Exec
# to get the values of the Exec= key for the Desktop Entry group.
get_key()
{
    local file="${1}"
    local key="${2}"
    local desktop_entry=""

    IFS_="${IFS}"
    IFS=""
    while read line
    do
        case "$line" in
            "[Desktop Entry]")
                desktop_entry="y"
            ;;
            # Reset match flag for other groups
            "["*)
                desktop_entry=""
            ;;
            "${key}="*)
                # Only match Desktop Entry group
                if [ -n "${desktop_entry}" ]
                then
                    echo "${line}" | cut -d= -f 2-
                fi
        esac
    done < "${file}"
    IFS="${IFS_}"
}

open_darwin()
{
    open "$1"

    if [ $? -eq 0 ]; then
        exit_success
    else
        exit_failure_operation_failed
    fi
}

open_kde()
{
    if [ -n "${KDE_SESSION_VERSION}" ]; then
      case "${KDE_SESSION_VERSION}" in
        4)
          kde-open "$1"
        ;;
        5)
          kde-open${KDE_SESSION_VERSION} "$1"
        ;;
      esac
    else
        kfmclient exec "$1"
        kfmclient_fix_exit_code $?
    fi

    if [ $? -eq 0 ]; then
        exit_success
    else
        exit_failure_operation_failed
    fi
}

open_gnome()
{
    if gvfs-open --help 2>/dev/null 1>&2; then
        gvfs-open "$1"
    else
        gnome-open "$1"
    fi

    if [ $? -eq 0 ]; then
        exit_success
    else
        exit_failure_operation_failed
    fi
}

open_mate()
{
    if gvfs-open --help 2>/dev/null 1>&2; then
        gvfs-open "$1"
    else
        mate-open "$1"
    fi

    if [ $? -eq 0 ]; then
        exit_success
    else
        exit_failure_operation_failed
    fi
}

open_xfce()
{
    exo-open "$1"

    if [ $? -eq 0 ]; then
        exit_success
    else
        exit_failure_operation_failed
    fi
}

open_enlightenment()
{
    enlightenment_open "$1"

    if [ $? -eq 0 ]; then
        exit_success
    else
        exit_failure_operation_failed
    fi
}

#-----------------------------------------
# Recursively search .desktop file

search_desktop_file()
{
    local default="$1"
    local dir="$2"
    local target="$3"

    local file=""
    # look for both vendor-app.desktop, vendor/app.desktop
    if [ -r "$dir/$default" ]; then
      file="$dir/$default"
    elif [ -r "$dir/`echo $default | sed -e 's|-|/|'`" ]; then
      file="$dir/`echo $default | sed -e 's|-|/|'`"
    fi

    if [ -r "$file" ] ; then
        command="$(get_key "${file}" "Exec" | first_word)"
        command_exec=`which $command 2>/dev/null`
        icon="$(get_key "${file}" "Icon")"
        # FIXME: Actually LC_MESSAGES should be used as described in
        # http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s04.html
        localised_name="$(get_key "${file}" "Name")"
        set -- $(get_key "${file}" "Exec" | last_word)
        # We need to replace any occurrence of "%f", "%F" and
        # the like by the target file. We examine each
        # argument and append the modified argument to the
        # end then shift.
        local args=$#
        local replaced=0
        while [ $args -gt 0 ]; do
            case $1 in
                %[c])
                    replaced=1
                    arg="${localised_name}"
                    shift
                    set -- "$@" "$arg"
                    ;;
                %[fFuU])
                    replaced=1
                    arg="$target"
                    shift
                    set -- "$@" "$arg"
                    ;;
                %[i])
                    replaced=1
                    shift
                    set -- "$@" "--icon" "$icon"
                    ;;
                *)
                    arg="$1"
                    shift
                    set -- "$@" "$arg"
                    ;;
            esac
            args=$(( $args - 1 ))
        done
        [ $replaced -eq 1 ] || set -- "$@" "$target"
        "$command_exec" "$@"

        if [ $? -eq 0 ]; then
            exit_success
        fi
    fi

    for d in $dir/*/; do
        [ -d "$d" ] && search_desktop_file "$default" "$d" "$target"
    done
}


open_generic_xdg_mime()
{
    filetype="$2"
    default=`xdg-mime query default "$filetype"`
    if [ -n "$default" ] ; then
        xdg_user_dir="$XDG_DATA_HOME"
        [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"

        xdg_system_dirs="$XDG_DATA_DIRS"
        [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/

DEBUG 3 "$xdg_user_dir:$xdg_system_dirs"
        for x in `echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`; do
            search_desktop_file "$default" "$x/applications/" "$1"
        done
    fi
}

open_generic_xdg_file_mime()
{
    filetype=`xdg-mime query filetype "$1" | sed "s/;.*//"`
    open_generic_xdg_mime "$1" "$filetype"
}

open_generic_xdg_x_scheme_handler()
{
    scheme="`echo $1 | sed -n 's/\(^[[:alnum:]+\.-]*\):.*$/\1/p'`"
    if [ -n $scheme ]; then
        filetype="x-scheme-handler/$scheme"
        open_generic_xdg_mime "$1" "$filetype"
    fi
}

open_generic()
{
    # Paths or file:// URLs
    if (echo "$1" | grep -q '^file://' ||
        ! echo "$1" | egrep -q '^[[:alpha:]+\.\-]+:'); then

        local file="$1"

        # Decode URLs
        if echo "$file" | grep -q '^file:///'; then
            file=${file#file://}
            file="$(printf "$(echo "$file" | sed -e 's@%\([a-f0-9A-F]\{2\}\)@\\x\1@g')")"
        fi
        file_check=${file%%#*}
        file_check=${file_check%%\?*}
        check_input_file "$file_check"

        filetype=`xdg-mime query filetype "$file_check" | sed "s/;.*//"`
        open_generic_xdg_mime "$file" "$filetype"

        if which run-mailcap 2>/dev/null 1>&2; then
            run-mailcap --action=view "$file"
            if [ $? -eq 0 ]; then
                exit_success
            fi
        fi

        if mimeopen -v 2>/dev/null 1>&2; then
            mimeopen -L -n "$file"
            if [ $? -eq 0 ]; then
                exit_success
            fi
        fi
    fi

    open_generic_xdg_x_scheme_handler "$1"

    IFS=":"
    for browser in $BROWSER; do
        if [ x"$browser" != x"" ]; then

            browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
            if [ $? -ne 0 ]; then
                browser_with_arg=$browser;
            fi

            if [ x"$browser_with_arg" = x"$browser" ]; then
                eval '$browser "$1"'$xdg_redirect_output;
            else eval '$browser_with_arg'$xdg_redirect_output;
            fi

            if [ $? -eq 0 ]; then
                exit_success;
            fi
        fi
    done

    exit_failure_operation_impossible "no method available for opening '$1'"
}

open_lxde()
{
    # pcmanfm only knows how to handle file:// urls and filepaths, it seems.
    if (echo "$1" | grep -q '^file://' ||
        ! echo "$1" | egrep -q '^[[:alpha:]+\.\-]+:')
    then
        local file="$1"

        # handle relative paths
        if ! echo "$file" | egrep -q '^(file://)?/'; then
            file="$(pwd)/$file"
        fi

        pcmanfm "$file"

    else
        open_generic "$1"
    fi

    if [ $? -eq 0 ]; then
        exit_success
    else
        exit_failure_operation_failed
    fi
}

[ x"$1" != x"" ] || exit_failure_syntax

url=
while [ $# -gt 0 ] ; do
    parm="$1"
    shift

    case "$parm" in
      -*)
        exit_failure_syntax "unexpected option '$parm'"
        ;;

      *)
        if [ -n "$url" ] ; then
            exit_failure_syntax "unexpected argument '$parm'"
        fi
        url="$parm"
        ;;
    esac
done

if [ -z "${url}" ] ; then
    exit_failure_syntax "file or URL argument missing"
fi

detectDE

if [ x"$DE" = x"" ]; then
    DE=generic
fi

DEBUG 2 "Selected DE $DE"

# sanitize BROWSER (avoid caling ourselves in particular)
case "${BROWSER}" in
    *:"xdg-open"|"xdg-open":*)
        BROWSER=$(echo $BROWSER | sed -e 's|:xdg-open||g' -e 's|xdg-open:||g')
        ;;
    "xdg-open")
        BROWSER=
        ;;
esac

# if BROWSER variable is not set, check some well known browsers instead
if [ x"$BROWSER" = x"" ]; then
    BROWSER=links2:elinks:links:lynx:w3m
    if [ -n "$DISPLAY" ]; then
        BROWSER=x-www-browser:firefox:seamonkey:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER
    fi
fi

case "$DE" in
    kde)
    open_kde "$url"
    ;;

    gnome*)
    open_gnome "$url"
    ;;

    mate)
    open_mate "$url"
    ;;

    xfce)
    open_xfce "$url"
    ;;

    lxde)
    open_lxde "$url"
    ;;

    enlightenment)
    open_enlightenment "$url"
    ;;

    generic)
    open_generic "$url"
    ;;

    *)
    exit_failure_operation_impossible "no method available for opening '$url'"
    ;;
esac

xdg-open uses the value registered in ~/.config/mimeapps.list

So for brackets to actually use firefox - you have to register firefox as your default browser.

Check the utility script at [root tip] [Utility Script] Setting the default web-browser

I ran the script

~ set-browser.sh firefox.desktop                                                                                               ✔ 
Default browser set using firefox.desktop

But Brackets still fails to launch Firefox.

This is my ~/.config/mimeapps.list after running the script.

[Added Associations]
application/pdf=org.kde.okular.desktop;
inode/directory=org.kde.dolphin.desktop;
text/vnd.trolltech.linguist=jetbrains-phpstorm.desktop;
x-scheme-handler/geo=openstreetmap-geo-handler.desktop;
x-scheme-handler/http=firefox.desktop;
x-scheme-handler/https=firefox.desktop;
x-scheme-handler/mailto=betterbird.desktop;
x-scheme-handler/tel=org.kde.kdeconnect.handler.desktop;

[Default Applications]
application/pdf=org.kde.okular.desktop;
inode/directory=org.kde.dolphin.desktop;
text/vnd.trolltech.linguist=jetbrains-phpstorm.desktop;
x-scheme-handler/geo=openstreetmap-geo-handler.desktop;
x-scheme-handler/http=firefox.desktop
x-scheme-handler/https=firefox.desktop
x-scheme-handler/jetbrains=jetbrains-toolbox.desktop
x-scheme-handler/mailto=betterbird.desktop;
x-scheme-handler/sgnl=signal-desktop.desktop
x-scheme-handler/signalcaptcha=signal.desktop
x-scheme-handler/tel=org.kde.kdeconnect.handler.desktop;
text/html=firefox.desktop

Just a side question: Why do I have to use this method to set the default browser? Shouldn’t it be enough to do that in KDE system settings under default applications?

You don`t have to. I created the script out of frustration.

Perhaps

But since it didn`t work one would suspect it is flatpak related

What does it do?

It just gets stuck at “live preview: connecting…” (mousing over the Live preview button).
As someone at Brackets Github mentioned checking the console log, here it is:

Less has finished and no sheets were loaded.
KeyBindingManager.js:578 Failed to normalize Cmd-Shift-]
KeyBindingManager.js:578 Failed to normalize Cmd-Shift-[
NodeSocketTransport.js:84 NodeSocketTransport - start
KeyBindingManager.js:747 Cannot assign Ctrl-R to refactoring.renamereference. It is already assigned to refactoring.renamereference_addBinding @ KeyBindingManager.js:747
main.js:289 Php tooling: Starting the service
https://getupdates.brackets.io/getupdates/?_=1667488585105 Failed to load resource: the server responded with a status of 404 ()
https://getupdates.brackets.io/getupdates/?_=1667488585107 Failed to load resource: the server responded with a status of 404 ()
ClientLoader.js:69 /app/www/extensions/default/PhpTooling/client.js domain successfully created
https://s3.amazonaws.com/extend.brackets/registry.json?_=1667488585104 Failed to load resource: the server responded with a status of 403 (Forbidden)
https://health.brackets.io/healthDataLog Failed to load resource: net::ERR_NAME_NOT_RESOLVED
HealthDataManager.js:203 Error in sending Health Data. Response : undefined. Status : error. Error : (anonymous function) @ HealthDataManager.js:203
NodeSocketTransport.js:84 NodeSocketTransport - send,,{"method":"Runtime.evaluate","params":{"expression":"_LD.hideHighlight()"},"id":1}
NodeDebugUtils.js:111 [node-error 4:16:31 PM] (node:7) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with code 4handleLogEvent @ NodeDebugUtils.js:111
NodeSocketTransport.js:84 NodeSocketTransport - send,,{"method":"Runtime.evaluate","params":{"expression":"_LD.hideHighlight()"},"id":2}

Can you see anything useful here?

I think that if it’s Flatpak-related, it’s not the only corner of Manjaro where this problem exists.
I’ve experienced a number of instances where application defaults were not respected (and I think we should start a collection of that somewhere separate). Basically, I think that on current Manjaro (possibly your average current Linux desktop), there’s no such thing as a system-wide default anymore for file type associations.

Manjaro manages that with xdg-open, but it would appear its specifications do not take effect everywhere. It might have to do with all the different ecosystems coming together here:

  • For one, Browsers have their own settings for handling every file type. That’s been the case for, like, ever, and used to work fine - but I’ve also seen cases where Firefox hands the decision to xdg-open, and then it used the wrong app (but got it right when the file was not coming from firefox).
  • Consequently, Electron apps have their own idea for handling each file type, because they are Chrome browsers.
  • We have three cross-distro packaging formats, and I don’t know if they all like xdg-open and play nicely with it
  • There’s the admitted edge case of Wine, which I will never understand how it works.
  • feel free to complete this list, if applicable.

What bugs me the most, however, is that we have no user-friendly way of setting default apps system-wide for all file types. KDE graciously lets us chose six kinds of default apps in system settings, the rest is handled by Xdg-open. We shouldn’t need to write a bash script to change these settings (let alone for standard apps that a GUI setting is supposed to take care of) - even Windows does it better.
Bottom line is we need a user-friendly GUI for easily managing each file-type association system-wide. I also go so far as to say it falls under a distro’s responsibility to provide such a thing. If all the others don’t have it either, it’s all the more reason to get on it real quick.

It is striking that it appears brackets is unmaintained - that is - at least the version you are using.

I mean

  • it returns 404 on connecting tol getupdates.bracket.io
  • it returns 403 on connecting to s3.amazonaws.com
  • it return server not found for health.brackets.io

so the issue may not be the issue you expect - what you see could merely be a result of the failing application.

I don’t want to put energy into a failing application. Also the bug report you are referring to is 7 year old.

xdg is a freedesktop.org standard for associating various mimetypes with a one or more applications - so I don’t really see the issue lying there.

You can test it by opening Konsole then

echo "This is a html file" > ~/test.html
xdg-open ~/test.html

As I said - I wrote out of frustration for my own use case - I shared it - if the existing interface suits your needs then - by all means - use that.

1 Like

You are correct, apologies for this oversight of mine:

Thanks for your help so far and for that useful script though.
I didn’t expect Flathub to ship an outdated/unmaintained version (the one from Adobe). The current community version is 2.0.1 and apparently not packaged for Linux anymore.

Yes, it works, it opens a Firefox tab.

It obviously does not suit my needs and probably didn’t suit yours either when you wrote the script - which is why I’m pleading for a better solution from Manjaro. I guess I’ll bring it up at a better suited place (any suggestions?) soon™. :slightly_smiling_face: Have a great day!

It suit my needs for setting different default webrowsers on a as-needed basis and that happens quite frequently :slight_smile:

Edit:
It occurred to me you were referring to the GUI interface - it may do the same thing - but I am not the clicking gui interface type - scripting such tasks works magnitudes faster for me with mundane tasks like setting a default browser.

Using the terminal requires knowledge on how the engine is put together - but when that knowledge is in place - I get my tasks done quicker than using an interface.

Examples of tasks I have scripted

  • mounting smb share as user using gio
  • setting my default browser (this thread)
  • starting a specific VirtualBox VM
  • starting a RDP connection to the servers I work with
  • setting up my partitions and folders after a system cleanup
  • preconfiguring raspberry pi sdcard for WiFi setup
 $ ls -l ~/.local/bin
total 48
-rwxr-xr-x 1 fh fh 2813 Nov  2 06:58 gio-mount.sh
-rwxr-xr-x 1 fh fh  957 Nov  2 09:25 iis-inno
-rwxr-xr-x 1 fh fh  964 Nov  2 09:26 iis-local
-rwxr-xr-x 1 fh fh  953 Nov  2 09:26 iis-sbs
-rwxr-xr-x 1 fh fh 2131 Nov  2 06:58 rpi-wifi.sh
-rwxr-xr-x 1 fh fh 1079 Nov  2 06:58 set-browser.sh
-rwxr-xr-x 1 fh fh   56 Nov  2 06:58 win10
-rwxr-xr-x 1 fh fh   53 Nov  2 06:58 win2019
-rwxr-xr-x 1 fh fh   47 Nov  2 06:58 winxp

Not to mention the satisfaction of adding knowledge to my 2.5 miilion GB brain storage :slight_smile:

In 2010 an article in the journal Scientific American Mind said that one estimate of the capacity of our brain was approximately 2.5 million gigabytes, the equivalent of three million hours (over 300 years) of recorded TV. – Watchtower Dec 2022New Estimate Boosts the Human Brain's Memory Capacity 10-Fold - Scientific American

So there is a GUI for Xdg-open?

When you adjust which programs open specifik mimetypes in KDE GUI the configuration is written to ~/.config/mimeapps.list - so yes.

KDE extends defaults with properties only KDE uses - and I have seen mimeapps.list in various places but the census is that user changes are written to ~/.config/mimeapps.list

And Xdg-open takes its orders from ~/.config/mimeapps.list?
and if it does, why did you write that script, rather than going to file associations in the GUI, or edit ~/.config/mimeapps.list directly?
Btw I never knew this GUI in KDE existed -just found it under
System Settings > Personalization Section > Applications > File associations!
And in the dozen instances I’ve head this problem with XDG-open before and hunted for solutions online, it was never mentioned.

Yes - it does.

If a given association does not exist it propagates backwards to system config in /etc → then distribution config in /usr.

But as snap and flatpak are selfcontained - they may have their own mimetypes.list - which in turn may reference a non-existing application - and this makes the call fail. In such case the user may be inclined to raise the issue on the distribution’s forum which of course will have no clue as to why the specific system will not behave as intended.

1 Like

This seems like it should light on the issue, if you understand it (I mostly don’t):

The reason there is no Flatpak-specific documentation for how this is configured is that there is no Flatpak-specific configuration.

he says…
In any case, it appears it’s an issue on other distros.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.