Opened 5 years ago

Closed 5 years ago

#538 closed task (fixed)

Nicotine+ and external programs

Reported by: quinox Owned by: quinox
Priority: normal Milestone: Release 1.2.14
Component: nicotine Version: 1.2.14
Keywords: Cc:

Description

Hi,

by default, Nicotine+ calls the following external programs:

  • xmms to play audio files,
  • rox to open a file manager.

Note that no handler for http/https is set by default. But users may be disappointed by the fact that these settings don't correspond to their favorite applications, even if they could change it in the settings.

Under Linux, the Freedesktop team had defined a set of tools, xdg-utils, to handle in a transparent way files or URLs in the user's preferred application. These tools are a defacto standard, installed by default on most of the Linux distributions (see http://portland.freedesktop.org/wiki/ and http://portland.freedesktop.org/xdg-utils-1.0/xdg-open.html for more details). So all the previous external programs called by Nicotine+ could be replaced by default by xdg-open, and so audio files or folders opened by the user's default application, whatever its desktop environment. And then developers can rely on xdg-open to provide a better integration of Nicotine+ whatever the environment.

The attached patch sets xdg-open as the default handler for audio files and folders. It sets also xdg-open as the default handler to manage http/https protocols.

diff -up nicotine+-1.2.14/pynicotine/config.py.orig nicotine+-1.2.14/pynicotine/config.py
--- nicotine+-1.2.14/pynicotine/config.py.orig  2010-01-01 17:50:43.106168257 +0100
+++ nicotine+-1.2.14/pynicotine/config.py       2010-01-01 17:54:11.147042575 +0100
@@ -290,7 +290,7 @@ class Config:
        "soundenabled": 1, \
        "soundtheme": "", \
        "soundcommand": "play -q", \
-       "filemanager": "rox $", \
+       "filemanager": "xdg-open $", \
        "enabletrans": 0, \
        "speechenabled": 0, \
        "speechprivate": "%(user)s told you.. %(message)s", \
@@ -312,7 +312,7 @@ class Config:
 \
 "urls":{
        "urlcatching":1, \
-       "protocols":{"http":"", "https":""}, \
+       "protocols":{"http":"xdg-open \"%s\"", "https":"xdg-open \"%s\""}, \
        "humanizeurls":1, \
        }, \
 \
@@ -328,7 +328,7 @@ class Config:
        }, \
 \
 "players": { \
-       "default": "xmms -e $", \
+       "default": "xdg-open $", \
        "npothercommand": "", \
        "npplayer": "infopipe", \
        "npformatlist": [], \

Change History (2)

comment:1 Changed 5 years ago by quinox

Actually, we don't set the HTTP/HTTPS handlers for a reason: Because the http/https keys are inserted in the dictionary they turn into clickable links, and because they are empty python will call the default-configured browser to open them.

comment:2 Changed 5 years ago by quinox

  • Resolution set to fixed
  • Status changed from new to closed

Yup you're totally right, xdg-open works like a charm and isn't application specific. Applied with r1354, thanks for the input :)

Note: See TracTickets for help on using tickets.