Add termux support for fish_config.

This commit is contained in:
Lior Stern 2019-10-25 16:36:51 +03:00 committed by Fabian Homborg
parent 0ef6a136e8
commit 5b2250883a

View File

@ -8,6 +8,7 @@ try:
except ImportError: except ImportError:
from cgi import escape as escape_html from cgi import escape as escape_html
from distutils.version import LooseVersion from distutils.version import LooseVersion
from distutils.spawn import find_executable
import glob import glob
import multiprocessing.pool import multiprocessing.pool
import operator import operator
@ -49,6 +50,10 @@ def is_wsl():
return True return True
return False return False
def is_termux():
""" Return whether we are running under the Termux application for Android"""
return 'com.termux' in os.environ['PATH'] and find_executable('termux-open-url')
# Disable CLI web browsers # Disable CLI web browsers
term = os.environ.pop("TERM", None) term = os.environ.pop("TERM", None)
@ -1505,6 +1510,8 @@ if isMacOS10_12_5_OrLater():
subprocess.check_call(["open", fileurl]) subprocess.check_call(["open", fileurl])
elif is_wsl(): elif is_wsl():
subprocess.call(["cmd.exe", "/c", "start %s" % url]) subprocess.call(["cmd.exe", "/c", "start %s" % url])
elif is_termux():
subprocess.call(["termux-open-url", url])
else: else:
webbrowser.open(fileurl) webbrowser.open(fileurl)