From 5b2250883a977d17c0bf691eb9fd24ce148b923b Mon Sep 17 00:00:00 2001
From: Lior Stern <liorst4@gmail.com>
Date: Fri, 25 Oct 2019 16:36:51 +0300
Subject: [PATCH] Add termux support for fish_config.

---
 share/tools/web_config/webconfig.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py
index a4e9e09dc..81e1d527f 100755
--- a/share/tools/web_config/webconfig.py
+++ b/share/tools/web_config/webconfig.py
@@ -8,6 +8,7 @@ try:
 except ImportError:
     from cgi import escape as escape_html
 from distutils.version import LooseVersion
+from distutils.spawn import find_executable
 import glob
 import multiprocessing.pool
 import operator
@@ -49,6 +50,10 @@ def is_wsl():
                 return True
     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
 term = os.environ.pop("TERM", None)
@@ -1505,6 +1510,8 @@ if isMacOS10_12_5_OrLater():
     subprocess.check_call(["open", fileurl])
 elif is_wsl():
     subprocess.call(["cmd.exe", "/c", "start %s" % url])
+elif is_termux():
+    subprocess.call(["termux-open-url", url])
 else:
     webbrowser.open(fileurl)