Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
poezio
poezio
Commits
ba32d74a
Commit
ba32d74a
authored
Jun 26, 2014
by
Akim Sadaoui
Committed by
louiz’
Jun 26, 2014
Browse files
Use xdg-open by default in the /link plugin
fix
#2550
parent
6698ed80
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/link.py
View file @
ba32d74a
...
...
@@ -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
louiz’
@louiz
mentioned in issue
#2566 (closed)
·
Aug 21, 2018
mentioned in issue
#2566 (closed)
mentioned in issue #2566
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment