summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-11-04 16:26:26 +0100
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-11-04 16:26:26 +0100
commit094a454324c31b62b418289821b4dc71790736c1 (patch)
treed662772082b898d037fd0a213280cca1278ed927
parente3dd6aeca60ab216b079c87aa57078a951d0a08b (diff)
downloadxmobar-094a454324c31b62b418289821b4dc71790736c1.tar.gz
xmobar-094a454324c31b62b418289821b4dc71790736c1.tar.bz2
Preserve backward compatibility
WARNING: this patch changes the configuration file This patch reintroduces backward compatibility with recent changes in the configuration option. Now Top and Bottom do not take any argument. To set the width and alignment used TopW (Align Int) and BottomW (Align Int) instead, where Align is either C, L or R. darcs-hash:20071104152626-d6583-a5ee9d7f1e20b33e47b902d11267fb6d2e623483.gz
-rw-r--r--Config.hs6
-rw-r--r--Main.hs16
-rw-r--r--Xmobar.hs22
3 files changed, 22 insertions, 22 deletions
diff --git a/Config.hs b/Config.hs
index 7044a22..aff4db6 100644
--- a/Config.hs
+++ b/Config.hs
@@ -44,8 +44,8 @@ data Config =
, template :: String -- ^ The output template
} deriving (Read)
-data XPosition = Top Width | Bottom Width | Static {xpos, ypos, width, height :: Int} deriving ( Read, Eq )
-data Width = A | L Int | R Int | C Int deriving ( Read, Eq )
+data XPosition = Top | TopW Width | Bottom | BottomW Width | Static {xpos, ypos, width, height :: Int} deriving ( Read, Eq )
+data Width = L Int | R Int | C Int deriving ( Read, Eq )
-- | The default configuration values
defaultConfig :: Config
@@ -53,7 +53,7 @@ defaultConfig =
Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
, bgColor = "#000000"
, fgColor = "#BFBFBF"
- , position = Top A
+ , position = Top
, commands = []
, sepChar = "%"
, alignSep = "}{"
diff --git a/Main.hs b/Main.hs
index bf31d3b..2381373 100644
--- a/Main.hs
+++ b/Main.hs
@@ -132,14 +132,14 @@ 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 A }) >> go
- B -> modifyIORef conf (\c -> c { position = Bottom A}) >> 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
+ 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
Left e -> putStr (e ++ usage) >> exitWith (ExitFailure 1)
diff --git a/Xmobar.hs b/Xmobar.hs
index e26d2f7..4545dcd 100644
--- a/Xmobar.hs
+++ b/Xmobar.hs
@@ -144,14 +144,14 @@ createWin d fs c = do
setPosition :: XPosition -> Rectangle -> Dimension -> (Position,Position,Dimension,Dimension,Bool)
setPosition p (Rectangle rx ry rw rh) ht =
case p of
- Top A -> (rx , ry , rw , h , True)
- Top (L i) -> (rx , ry , nw i , h , True)
- Top (R i) -> (right i, ry , nw i , h , True)
- Top (C i) -> (center i, ry , nw i , h , True)
- Bottom A -> (rx , ny , rw , h , True)
- Bottom (L i) -> (rx , ny , nw i , h , True)
- Bottom (R i) -> (right i, ny , nw i , h , True)
- Bottom (C i) -> (center i, ny , nw i , h , True)
+ Top -> (rx , ry , rw , h , True)
+ TopW (L i) -> (rx , ry , nw i , h , True)
+ TopW (R i) -> (right i, ry , nw i , h , True)
+ TopW (C i) -> (center i, ry , nw i , h , True)
+ Bottom -> (rx , ny , rw , h , True)
+ BottomW (L i) -> (rx , ny , nw i , h , True)
+ BottomW (R i) -> (right i, ny , nw i , h , True)
+ BottomW (C i) -> (center i, ny , nw i , h , True)
Static cx cy cw ch -> (fi cx , fi cy , fi cw, fi ch, True)
where
ny = ry + fi (rh - ht)
@@ -175,9 +175,9 @@ setProperties h c d w = do
getStrutValues :: Dimension -> Config -> [Int]
getStrutValues h c =
case position c of
- Top _ -> [0, 0, fi h, 0 ]
- Bottom _ -> [0, 0, 0 , fi h]
- _ -> [0, 0, 0 , 0 ]
+ Top -> [0, 0, fi h, 0 ]
+ Bottom -> [0, 0, 0 , fi h]
+ _ -> [0, 0, 0 , 0 ]
updateWin :: TVar String -> X ()
updateWin v = do