module XMonadContrib.BinaryConfig where import System.Posix.Files import Foreign (unsafePerformIO) data Config = Config { workspaceNumber :: Int , bColor :: String } deriving (Read, Show) readConfig :: FilePath -> Config readConfig f = unsafePerformIO $ do file <- fileExist f s <- if file then readFile f else error $ f ++ ": file not found!\n" case reads s of [(conf,_)] -> return conf [] -> error $ f ++ ": configuration file contains errors!\n" _ -> error ("Some problem occured. Aborting...")