diff options
author | jao <jao@gnu.org> | 2018-11-30 05:27:53 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2018-11-30 05:27:53 +0000 |
commit | a9df65ad952251d2f0c837add0cfe4626d321bf8 (patch) | |
tree | 14111b70e96ab310c6d70700f32f8966059adb70 /app/Main.hs | |
parent | fa681551411e8c74e6462f6997c37fcc38335d4d (diff) | |
download | xmobar-a9df65ad952251d2f0c837add0cfe4626d321bf8.tar.gz xmobar-a9df65ad952251d2f0c837add0cfe4626d321bf8.tar.bz2 |
Self-compilation a la xmonad
Diffstat (limited to 'app/Main.hs')
-rw-r--r-- | app/Main.hs | 41 |
1 files changed, 1 insertions, 40 deletions
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 |