diff --git a/lib/XMonad/Internal/Command/Desktop.hs b/lib/XMonad/Internal/Command/Desktop.hs index b9d4fe6..6b93a3d 100644 --- a/lib/XMonad/Internal/Command/Desktop.hs +++ b/lib/XMonad/Internal/Command/Desktop.hs @@ -128,8 +128,7 @@ runEditor = sometimesIO_ "text editor" "emacs" tree cmd where cmd = spawnCmd myEditor ["-c", "-e", doubleQuote "(select-frame-set-input-focus (selected-frame))"] - tree = toAnd_ (sysExe myEditor) (socketExists "emacs" socketName) - socketName = ( "emacs" "server") <$> getEnv "XDG_RUNTIME_DIR" + tree = Only_ $ sysExe myEditor runFileManager :: SometimesX runFileManager = sometimesExe "file browser" "pcmanfm" True "pcmanfm" diff --git a/lib/XMonad/Internal/Dependency.hs b/lib/XMonad/Internal/Dependency.hs index 5fdd66b..de70393 100644 --- a/lib/XMonad/Internal/Dependency.hs +++ b/lib/XMonad/Internal/Dependency.hs @@ -119,6 +119,7 @@ import Data.Maybe import Data.Yaml import GHC.Generics (Generic) +import GHC.IO.Exception (ioe_description) import DBus hiding (typeOf) import DBus.Client @@ -780,12 +781,10 @@ socketExists n = IOTest_ ("test if " ++ n ++ " socket exists") . socketExists' socketExists' :: IO FilePath -> IO (Maybe Msg) socketExists' getPath = do p <- getPath - e <- fileExist p - s <- isSocket <$> getFileStatus p - return $ case (e, s) of - (True, True) -> Nothing - (False, _) -> toErr $ "could not find socket at " ++ p - (_, False) -> toErr $ p ++ " is not a socket" + r <- tryIOError $ getFileStatus p + return $ case r of + Left e -> toErr $ ioe_description e + Right s -> if isSocket s then Nothing else toErr $ p ++ " is not a socket" where toErr = Just . Msg Error