summaryrefslogtreecommitdiffhomepage
path: root/Main.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-10-28 22:55:15 +0100
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-10-28 22:55:15 +0100
commitce2421af501d77d321a52e99e03f0862a6656fc4 (patch)
tree1377fce61407bc83151d5371267bc7d32b27e0c1 /Main.hs
parent00d7e261ec864b9cdbdd3fa1cd90e4121d08630d (diff)
downloadxmobar-ce2421af501d77d321a52e99e03f0862a6656fc4.tar.gz
xmobar-ce2421af501d77d321a52e99e03f0862a6656fc4.tar.bz2
Main: removed align and added alignSep configuration option
darcs-hash:20071028215515-d6583-35ab1241f1f285d5e029eb3c0542f8f66d74f059.gz
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs44
1 files changed, 22 insertions, 22 deletions
diff --git a/Main.hs b/Main.hs
index 973c84b..ba92716 100644
--- a/Main.hs
+++ b/Main.hs
@@ -54,7 +54,7 @@ main = do
cl <- parseTemplate conf (template conf)
vars <- mapM startCommand cl
(r,w) <- createWin d fs conf
- eventLoop (XConf d r w fs c) vars
+ eventLoop (XConf d r w fs conf) vars
freeFont d fs
-- | Reads the configuration files or quits with an error
@@ -82,7 +82,7 @@ data Opts = Help
| FgColor String
| T
| B
- | Align String
+ | AlignSep String
| Commands String
| SepChar String
| Template String
@@ -90,17 +90,17 @@ data Opts = Help
options :: [OptDescr Opts]
options =
- [ Option ['h','?' ] ["help" ] (NoArg Help ) "This help"
- , Option ['V' ] ["version" ] (NoArg Version ) "Show version information"
- , Option ['f' ] ["font" ] (ReqArg Font "font name" ) "The font name"
- , Option ['B' ] ["bgcolor" ] (ReqArg BgColor "bg color" ) "The background color. Default black"
- , Option ['F' ] ["fgcolor" ] (ReqArg FgColor "fg color" ) "The foreground color. Default grey"
- , 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"
- , Option ['a' ] ["align" ] (ReqArg Align "align" ) "The text alignment: center, left or right.\nDefault: left"
- , Option ['s' ] ["sepchar" ] (ReqArg SepChar "char" ) "The character used to separate commands in\nthe output template. Default '%'"
- , Option ['t' ] ["template" ] (ReqArg Template "tempate" ) "The output template"
- , Option ['c' ] ["commands" ] (ReqArg Commands "commands" ) "The list of commands to be executed"
+ [ Option ['h','?' ] ["help" ] (NoArg Help ) "This help"
+ , Option ['V' ] ["version" ] (NoArg Version ) "Show version information"
+ , Option ['f' ] ["font" ] (ReqArg Font "font name") "The font name"
+ , Option ['B' ] ["bgcolor" ] (ReqArg BgColor "bg color" ) "The background color. Default black"
+ , Option ['F' ] ["fgcolor" ] (ReqArg FgColor "fg color" ) "The foreground color. Default grey"
+ , 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"
+ , Option ['a' ] ["alignsep" ] (ReqArg AlignSep "alignsep" ) "Separators for left, center and right text\nalignment. Default: '}{'"
+ , Option ['s' ] ["sepchar" ] (ReqArg SepChar "char" ) "The character used to separate commands in\nthe output template. Default '%'"
+ , Option ['t' ] ["template" ] (ReqArg Template "tempate" ) "The output template"
+ , Option ['c' ] ["commands" ] (ReqArg Commands "commands" ) "The list of commands to be executed"
]
getOpts :: [String] -> IO ([Opts], [String])
@@ -132,16 +132,16 @@ doOpts conf (o:oo) =
case o of
Help -> putStr usage >> exitWith ExitSuccess
Version -> putStrLn version >> exitWith ExitSuccess
- Font s -> modifyIORef conf (\c -> c { font = s }) >> go
- BgColor s -> modifyIORef conf (\c -> c { bgColor = s }) >> go
- FgColor s -> modifyIORef conf (\c -> c { fgColor = s }) >> go
- T -> modifyIORef conf (\c -> c { position = Top }) >> go
- B -> modifyIORef conf (\c -> c { position = Bottom }) >> go
- Align s -> modifyIORef conf (\c -> c { align = s }) >> go
- SepChar s -> modifyIORef conf (\c -> c { sepChar = s }) >> go
- Template s -> modifyIORef conf (\c -> c { template = s }) >> go
+ Font s -> modifyIORef conf (\c -> c { font = s }) >> go
+ BgColor s -> modifyIORef conf (\c -> c { bgColor = s }) >> go
+ FgColor s -> modifyIORef conf (\c -> c { fgColor = s }) >> go
+ T -> modifyIORef conf (\c -> c { position = Top }) >> go
+ B -> modifyIORef conf (\c -> c { position = Bottom }) >> go
+ AlignSep s -> modifyIORef conf (\c -> c { alignSep = s }) >> go
+ SepChar s -> modifyIORef conf (\c -> c { sepChar = s }) >> go
+ Template s -> modifyIORef conf (\c -> c { template = s }) >> go
Commands s -> case readCom s of
- Right x -> modifyIORef conf (\c -> c { commands = x })>> go
+ Right x -> modifyIORef conf (\c -> c { commands = x }) >> go
Left e -> putStr (e ++ usage) >> exitWith (ExitFailure 1)
where readCom str =
case readStr str of