From a9df65ad952251d2f0c837add0cfe4626d321bf8 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 30 Nov 2018 05:27:53 +0000 Subject: Self-compilation a la xmonad --- app/Main.hs | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) (limited to 'app') diff --git a/app/Main.hs b/app/Main.hs index 3c17447..ac618ce 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE FlexibleContexts #-} ----------------------------------------------------------------------------- -- | -- Module : Xmobar.Main @@ -15,45 +14,7 @@ module Main (main) where -import Data.List (intercalate) - -import System.Environment (getArgs) -import Control.Monad (unless) -import System.Posix.Files (fileExist) - import Xmobar -import Xmobar.App.Main -import Xmobar.App.Opts - --- $main --- | The main entry point main :: IO () -main = do - (o,file) <- getArgs >>= getOpts - (c,defaultings) <- case file of - [cfgfile] -> config cfgfile usage - _ -> defConfig usage - unless (null defaultings || notElem Debug o) $ putStrLn $ - "Fields missing from config defaulted: " ++ intercalate "," defaultings - doOpts c o >>= xmobar - --- | Read default configuration file or load the default config -defConfig :: String -> IO (Config,[String]) -defConfig msg = do - xdgConfigFile <- xmobarConfigFile - xdgConfigFileExists <- fileExist xdgConfigFile - if xdgConfigFileExists - then config xdgConfigFile msg - else return (defaultConfig,[]) - -config :: FilePath -> String -> IO (Config,[String]) -config f msg = do - let err m = error $ f ++ ": " ++ m - file <- fileExist f - r <- if file - then readConfig defaultConfig f - else err $ "file not found" ++ "\n" ++ msg - case r of - Left e -> err (show e) - Right res -> return res +main = xmobarMain -- cgit v1.2.3