Modify

Opened 14 years ago

Closed 14 years ago

Last modified 10 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 14 years ago.
Patch to implement the proposed change

Download all attachments as: .zip

Change History (10)

by quazgar, 14 years ago

Attachment: 0001.xdg-open.patch added

Patch to implement the proposed change

comment:1 by stoecker, 14 years ago

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

comment:2 by bastiK, 14 years ago

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

in reply to:  2 comment:3 by anonymous, 14 years ago

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 by bastiK, 14 years ago

Resolution: duplicate
Status: newclosed

comment:5 by bastiK, 14 years ago

Closed as duplicate of #5108.

comment:6 by anonymous, 11 years ago

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 by simon04, 11 years ago

Description: modified (diff)

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

comment:8 by simon04, 10 years ago

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 by Don-vip, 10 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.