Modify

Opened 12 years ago

Closed 12 years ago

Last modified 9 years ago

#5629 closed enhancement (fixed)

[Patch] Use xdg-open first for opening links

Reported by: quazgar Owned by: team
Priority: minor Milestone: 14.01
Component: Core Version: latest
Keywords: Cc:

Description (last modified by simon04)

Currently gnome-open is used as the first helper application to open links, regardless of which window manager is used.

The attached patch used xdg-open (from freedesktop.org) as the first try. If that fails, the other alternatives are used in the order used before. This should work for all modern window managers equally well.

I suggest applying this patch to the current source, I tried & tested it with latest svn (3652), it compiles and runs fine.

Attachments (1)

0001.xdg-open.patch (734 bytes) - added by quazgar 12 years ago.
Patch to implement the proposed change

Download all attachments as: .zip

Change History (10)

Changed 12 years ago by quazgar

Attachment: 0001.xdg-open.patch added

Patch to implement the proposed change

comment:1 Changed 12 years ago by stoecker

Summary: Patch: Use xdg-open first for opening links[Patch] Use xdg-open first for opening links

comment:2 Changed 12 years ago by bastiK

See #5108.

The code you patched is not executed under normal circumstances.

From OpenBrowser.java:

        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().browse(uri);
            } catch (Exception e) {
                e.printStackTrace();
                return e.getMessage();
            }
        } else {
            System.err.println("Warning: Desktop class is not supported. Platform dependent fall back for open url in browser.");

            if (Main.platform == null)
                throw new IllegalStateException(tr("Failed to open URL. There is currently no platform set. Please set a platform first."));
            try {
                Main.platform.openUrl(uri.toString());
            } catch (IOException e) {
                return e.getMessage();
            }
        }

Desktop.isDesktopSupported() should return true on all modern platforms.

Maybe like this:

(1) xdg-open

(2) Desktop.getDesktop().browse()

(3) gnome-open, kfmclient openURL, firefox

comment:3 in reply to:  2 Changed 12 years ago by anonymous

Replying to bastiK:

See #5108.

The code you patched is not executed under normal circumstances.

From OpenBrowser.java:
...

True, I didn't check if gnope-open was still used here with the latest svn version :) I just experienced the mentioned problem with the version I had installed (r3514), but the mentioned change seems to have been done in r3524.

Maybe like this:

(1) xdg-open

(2) Desktop.getDesktop().browse()

(3) gnome-open, kfmclient openURL, firefox

If someone wants to implement this order, I'd really welcome it, but it's no high priority for me any more :)

I'm just not sure though if all supported Desktops porperly configure, so maybe it should be simply

(1) Desktop.getDesktop().browse()

(2) xdg-open, gnome-open, kfmclient openURL, firefox

I would rather leave this decision to desktop environment experts though.

comment:4 Changed 12 years ago by bastiK

Resolution: duplicate
Status: newclosed

comment:5 Changed 12 years ago by bastiK

Closed as duplicate of #5108.

comment:6 Changed 10 years ago by anonymous

Please merge this patch. I understand that this code does not execute for a large percentage of your users, but it's 12 bytes, and helps those of us with unusual window managers (like me, and the person who sent in the patch.)

comment:7 Changed 10 years ago by simon04

Description: modified (diff)

+1. xdg-open seems to be standard for opening files by extension under Linux.

comment:8 Changed 9 years ago by simon04

Resolution: duplicatefixed

In 6682/josm:

fix #5629 #5108 #9568 - Make Unix web browsers configurable via browser.unix property

Default is ["xdg-open", "#DESKTOP#", "$BROWSER", "gnome-open", "kfmclient openURL", "firefox"].

comment:9 Changed 9 years ago by Don-vip

Component: unspecifiedCore
Milestone: 14.01

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.