summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAkim Sadaoui <mikayuoadas@gmail.com>2014-06-26 15:56:32 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-06-26 15:56:32 +0200
commitba32d74a61442c63b5366dd95b37d11e8fe3ab89 (patch)
treef2d701539f89132ba37787fc1d5b02bfe470d4d1 /plugins
parent6698ed806e820ab438e4cf6e53a6e99924b819f0 (diff)
downloadpoezio-ba32d74a61442c63b5366dd95b37d11e8fe3ab89.tar.gz
poezio-ba32d74a61442c63b5366dd95b37d11e8fe3ab89.tar.bz2
poezio-ba32d74a61442c63b5366dd95b37d11e8fe3ab89.tar.xz
poezio-ba32d74a61442c63b5366dd95b37d11e8fe3ab89.zip
Use xdg-open by default in the /link plugin
fix #2550
Diffstat (limited to 'plugins')
-rw-r--r--plugins/link.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/link.py b/plugins/link.py
index 3c4d99b9..b2c4470d 100644
--- a/plugins/link.py
+++ b/plugins/link.py
@@ -76,6 +76,7 @@ Options
.. _daemon.py: http://dev.louiz.org/projects/poezio/repository/revisions/master/raw/src/daemon.py
"""
+import platform
import re
from plugin import BasePlugin
@@ -84,6 +85,10 @@ import common
import tabs
url_pattern = re.compile(r'\b(http[s]?://(?:\S+))\b', re.I|re.U)
+app_mapping = {
+ 'Linux': 'xdg-open',
+ 'Darwin': 'open',
+}
class Plugin(BasePlugin):
def init(self):
@@ -132,7 +137,8 @@ class Plugin(BasePlugin):
link = self.find_link(nb)
if not link:
return self.api.information('No URL found.', 'Warning')
- self.core.exec_command([self.config.get('browser', 'firefox'), link])
+ default = app_mapping.get(platform.system(), 'firefox')
+ self.core.exec_command([self.config.get('browser', default), link])
def cleanup(self):
del self.config