summaryrefslogtreecommitdiffhomepage
path: root/src/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 92573b9..5266cd1 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -37,7 +37,7 @@ import System.Exit
import System.Environment
import System.FilePath ((</>))
import System.Posix.Files
-import Control.Monad (unless)
+import Control.Monad (unless, liftM)
import Signal (setupSignalHandler)
@@ -94,13 +94,13 @@ xdgConfigDir :: IO String
xdgConfigDir = do env <- getEnvironment
case lookup "XDG_CONFIG_HOME" env of
Just val -> return val
- Nothing -> getHomeDirectory >>= return . (</> ".config")
+ Nothing -> liftM (</> ".config") getHomeDirectory
xmobarConfigDir :: IO FilePath
-xmobarConfigDir = xdgConfigDir >>= return . (</> "xmobar")
+xmobarConfigDir = liftM (</> "xmobar") xdgConfigDir
getXdgConfigFile :: IO FilePath
-getXdgConfigFile = xmobarConfigDir >>= return . (</> "xmobarrc")
+getXdgConfigFile = liftM (</> "xmobarrc") xmobarConfigDir
-- | Read default configuration file or load the default config
readDefaultConfig :: IO (Config,[String])
@@ -130,6 +130,7 @@ data Opts = Help
| SepChar String
| Template String
| OnScr String
+ | IconRoot String
deriving Show
options :: [OptDescr Opts]
@@ -141,6 +142,8 @@ options =
"The background color. Default black"
, Option "F" ["fgcolor"] (ReqArg FgColor "fg color")
"The foreground color. Default grey"
+ , Option "i" ["iconroot"] (ReqArg IconRoot "path")
+ "Root directory for icon pattern paths. Default '.'"
, Option "o" ["top"] (NoArg T) "Place xmobar at the top of the screen"
, Option "b" ["bottom"] (NoArg B)
"Place xmobar at the bottom of the screen"
@@ -203,6 +206,7 @@ doOpts conf (o:oo) =
AlignSep s -> doOpts' (conf {alignSep = s})
SepChar s -> doOpts' (conf {sepChar = s})
Template s -> doOpts' (conf {template = s})
+ IconRoot s -> doOpts' (conf {iconRoot = s})
OnScr n -> doOpts' (conf {position = OnScreen (read n) $ position conf})
Commands s -> case readCom 'c' s of
Right x -> doOpts' (conf {commands = x})