run xdg-open instead of webbrowser when opening files. Fixes #5751
This commit is contained in:
parent
56fd8b246e
commit
225f74f0b8
1 changed files with 17 additions and 7 deletions
|
@ -673,6 +673,9 @@ def get_contact_dict_for_account(account):
|
||||||
|
|
||||||
def launch_browser_mailer(kind, uri):
|
def launch_browser_mailer(kind, uri):
|
||||||
# kind = 'url' or 'mail'
|
# kind = 'url' or 'mail'
|
||||||
|
if kind == 'url' and uri.startswith('file://'):
|
||||||
|
launch_file_manager(uri)
|
||||||
|
return
|
||||||
if kind in ('mail', 'sth_at_sth') and not uri.startswith('mailto:'):
|
if kind in ('mail', 'sth_at_sth') and not uri.startswith('mailto:'):
|
||||||
uri = 'mailto:' + uri
|
uri = 'mailto:' + uri
|
||||||
|
|
||||||
|
@ -698,18 +701,25 @@ def launch_browser_mailer(kind, uri):
|
||||||
|
|
||||||
|
|
||||||
def launch_file_manager(path_to_open):
|
def launch_file_manager(path_to_open):
|
||||||
|
if not path_to_open.startswith('file://'):
|
||||||
uri = 'file://' + path_to_open
|
uri = 'file://' + path_to_open
|
||||||
|
if os.name == 'nt':
|
||||||
|
try:
|
||||||
|
os.startfile(path_to_open) # if pywin32 is installed we open
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
if not gajim.config.get('autodetect_browser_mailer'):
|
if not gajim.config.get('autodetect_browser_mailer'):
|
||||||
command = gajim.config.get('custom_file_manager')
|
command = gajim.config.get('custom_file_manager')
|
||||||
if command == '': # if no app is configured
|
if command == '': # if no app is configured
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
command = 'xdg-open'
|
||||||
command = build_command(command, path_to_open)
|
command = build_command(command, path_to_open)
|
||||||
try:
|
try:
|
||||||
exec_command(command)
|
exec_command(command)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
|
||||||
webbrowser.open(uri)
|
|
||||||
|
|
||||||
def play_sound(event):
|
def play_sound(event):
|
||||||
if not gajim.config.get('sounds_on'):
|
if not gajim.config.get('sounds_on'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue