Ask Your Question
1

xdg-open fails to open URLs in fedora 27/lxde

asked 2018-05-30 07:23:37 -0600

AnatolijNowak gravatar image

I have fedora 27 with LXDE desctop. Every time i want to open URL using

xdg-open http://example.org

I got error displayed in GUI message saying

 /home/vodolaz095/http:/example.org: No such file or directory?

About 1 month ago it opened page in default firefox browser.

I have unmodified firefox.desctop at /usr/share/application. I have firefox as default browser, and

[vodolaz095@ivory ~]$ xdg-mime query default  x-scheme-handler/https
userapp-Firefox-UEQJYY.desktop
[vodolaz095@ivory ~]$ xdg-mime query default  x-scheme-handler/http
userapp-Firefox-UEQJYY.desktop

How to fix it? i want xdg-open to start firefox with url i provided to it

edit retag flag offensive close merge delete

Comments

WHat is the contents of userapp-Firefox-UEQJYY.desktop, especially the "Exec=" line

The file should either be in $HOME/.local/share/applications/ or /usr/share/applications/

villykruse gravatar imagevillykruse ( 2018-05-30 09:47:18 -0600 )edit

Contents of file is

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
NoDisplay=true
Exec=/usr/bin/firefox %u
Name=Firefox
Comment=Custom definition for Firefox
AnatolijNowak gravatar imageAnatolijNowak ( 2018-05-30 11:13:33 -0600 )edit

it is worth notice that $ firefox http://example.org works as expected - opens this site in new tab.

AnatolijNowak gravatar imageAnatolijNowak ( 2018-05-30 11:15:20 -0600 )edit

also in firefox.desctop the same command for starting browser is used

[vodolaz095@tractor oldcity]$ cat /usr/share/applications/firefox.desktop | grep Exec
Exec=firefox %u
Exec=firefox %u
Exec=firefox --private-window %u

Probably its issue with configuration of xdg-open, where to search it?

AnatolijNowak gravatar imageAnatolijNowak ( 2018-05-30 12:11:10 -0600 )edit

exo-open is a shell script, and, depending on your desktop environment, it calls a desktop specific program to open the resource.

Can you run

sh -x /usr/bin/xdg-open http://example.com

and show the last about 10 lines.

villykruse gravatar imagevillykruse ( 2018-05-30 13:41:29 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-05-31 01:31:12 -0600

villykruse gravatar image

updated 2018-05-31 06:32:21 -0600

Try upgrade to xdg-utils-1.1.3-2.fc28.noarch

The following may then be irrelevant.

The ouput in https://paste.fedoraproject.org/paste/Ne9gU9piLZq-1nZngIMVcg confirms that this is a bug in xdg-open, which only affects the lxde desktop environment.

A work-around that should work (I have no lxde environment to test with):

In the file /usr/bin/xdg-open find this section:

open_lxde()
{

    # pcmanfm only knows how to handle file:// urls and filepaths, it seems.
    if pcmanfm --help >/dev/null 2>&1 -a is_file_url_or_path "$1"; then
        local file="$(file_url_to_path "$1")"

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

        pcmanfm "$file"
    else
        open_generic "$1"
    fi

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

Then remove or comment out the part that says:

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

That is where your home directory is prefixed to any url that does not start with a /, thus also http: urls.

edit flag offensive delete link more

Comments

thanks, commenting out handle relative path works! i'll wait for xdg-utils-1.1.3-2.fc28.noarch patch released

AnatolijNowak gravatar imageAnatolijNowak ( 2018-05-31 07:22:43 -0600 )edit

You should already have xdg-utils-1.1.3-2.fc28.noarch in the normal fedora updates. I just saw it arrive this morning.

villykruse gravatar imagevillykruse ( 2018-05-31 08:59:47 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-05-30 07:22:44 -0600

Seen: 707 times

Last updated: May 31 '18