untested browser opening on Android

I've found multiple references to using the `am` command from the adb shell
to open a browser. So I assume it also works in a terminal emulator.
This commit is contained in:
Joey Hess 2013-04-18 12:52:55 -04:00
parent b521b64cf4
commit 911506bc93
2 changed files with 13 additions and 6 deletions

View file

@ -40,12 +40,17 @@ import Control.Concurrent
localhost :: HostName
localhost = "localhost"
{- Command to use to run a web browser. -}
browserCommand :: FilePath
{- Builds a command to use to start or open a web browser showing an url. -}
browserProc :: String -> CreateProcess
#ifdef darwin_HOST_OS
browserCommand = "open"
browserProc url = proc "open" [url]
#else
browserCommand = "xdg-open"
#ifdef __ANDROID__
browserProc url = proc "am"
["start", "-a", "android.intent.action.VIEW", "-d", url]
#else
browserProc url = proc "xdg-open" [url]
#endif
#endif
{- Binds to a socket on localhost, or possibly a different specified