module Web.Browser.Linux ( openBrowserLinux ) where import System.Exit (ExitCode(..)) import System.Process (rawSystem) openBrowserLinux :: String -> IO Bool openBrowserLinux :: String -> IO Bool openBrowserLinux url :: String url = ExitCode -> Bool exitCodeToBool (ExitCode -> Bool) -> IO ExitCode -> IO Bool forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b `fmap` String -> [String] -> IO ExitCode rawSystem String executable [String] argv where (executable :: String executable, argv :: [String] argv) = ("sh", ["-c", "xdg-open \"$0\" 2>&1 > /dev/null", String url]) exitCodeToBool :: ExitCode -> Bool exitCodeToBool ExitSuccess = Bool True exitCodeToBool (ExitFailure _) = Bool False