xmobar 0.20 → 0.20.1
raw patch · 9 files changed
+44/−18 lines, 9 files
Files
- news.md +10/−0
- readme.md +7/−1
- samples/xmobar.config +1/−0
- src/Config.hs +5/−1
- src/Main.hs +2/−3
- src/Parsers.hs +5/−2
- src/Window.hs +11/−9
- src/Xmobar.hs +2/−1
- xmobar.cabal +1/−1
news.md view
@@ -1,5 +1,15 @@ % xmobar - Release notes +## Version 0.20.1 (March 13, 2014)++_New features_++ - Back to picking by default the first available screen, with a new+ configuration option, `pickBroadest`, for choosing the broadest+ (see [issue #158]).++[issue #158]: https://github.com/jaor/xmobar/issues/76+ ## Version 0.20 (March 10, 2014) _New features_
readme.md view
@@ -11,7 +11,7 @@ features, like dynamic color management, icons, output templates, and extensibility through plugins. -This page documents xmobar 0.20 (see [release notes]).+This page documents xmobar 0.21 (see [release notes]). [This screenshot] shows xmobar running under [sawfish], with antialiased fonts. And [this one] is my desktop with [xmonad] and two@@ -266,6 +266,12 @@ : If you're running xmobar in a tiling window manager, you might need to set this option to `False` so that it behaves as a docked application. Defaults to `True`.++`pickBroadest`+: When multiple displays are available, xmobar will choose by default+ the first one to place itself. With this flag set to `True`+ (the default is `False`) it will choose the broadest one+ instead. `persistent` : When True the window status is fixed i.e. hiding or revealing is not
samples/xmobar.config view
@@ -5,6 +5,7 @@ , fgColor = "grey" , position = Top , lowerOnStart = True+ , pickBroadest = False , persistent = False , hideOnStart = False , commands = [ Run Weather "EGPF" ["-t","<station>: <tempC>C","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000
src/Config.hs view
@@ -58,6 +58,9 @@ , allDesktops :: Bool -- ^ Tell the WM to map to all desktops , overrideRedirect :: Bool -- ^ Needed for dock behaviour in some -- non-tiling WMs+ , pickBroadest :: Bool -- ^ Use the broadest display+ -- instead of the first one by+ -- default , lowerOnStart :: Bool -- ^ lower to the bottom of the -- window stack on initialization , persistent :: Bool -- ^ Whether automatic hiding should@@ -70,7 +73,7 @@ -- commands in the output template -- (default '%') , alignSep :: String -- ^ Separators for left, center and- -- right text alignment+ -- right text alignment , template :: String -- ^ The output template } deriving (Read) @@ -111,6 +114,7 @@ , persistent = False , allDesktops = True , overrideRedirect = True+ , pickBroadest = False , commands = [ Run $ Date "%a %b %_d %Y * %H:%M:%S" "theDate" 10 , Run StdinReader] , sepChar = "%"
src/Main.hs view
@@ -175,7 +175,7 @@ info :: String info = "xmobar " ++ showVersion version ++ "\n (C) 2007 - 2010 Andrea Rossato "- ++ "\n (C) 2010 - 2013 Jose A Ortega Ruiz\n "+ ++ "\n (C) 2010 - 2014 Jose A Ortega Ruiz\n " ++ mail ++ "\n" ++ license mail :: String@@ -188,7 +188,7 @@ "\nSee the License for more details." doOpts :: Config -> [Opts] -> IO Config-doOpts conf [] = +doOpts conf [] = return (conf {lowerOnStart = lowerOnStart conf && overrideRedirect conf}) doOpts conf (o:oo) = case o of@@ -217,4 +217,3 @@ "specified with the -" ++ c:" option\n") readStr str = [x | (x,t) <- reads str, ("","") <- lex t] doOpts' opts = doOpts opts oo-
src/Parsers.hs view
@@ -175,12 +175,14 @@ perms = permute $ Config <$?> pFont <|?> pBgColor <|?> pFgColor <|?> pPosition <|?> pBorder <|?> pBdColor <|?> pHideOnStart <|?> pAllDesktops- <|?> pOverrideRedirect <|?> pLowerOnStart <|?> pPersistent+ <|?> pOverrideRedirect <|?> pPickBroadest+ <|?> pLowerOnStart <|?> pPersistent <|?> pCommands <|?> pSepChar <|?> pAlignSep <|?> pTemplate + fields = [ "font", "bgColor", "fgColor", "sepChar", "alignSep" , "border", "borderColor" ,"template", "position"- , "allDesktops", "overrideRedirect"+ , "allDesktops", "overrideRedirect", "pickBroadest" , "hideOnStart", "lowerOnStart", "persistent", "commands" ] @@ -199,6 +201,7 @@ pBorder = readField border "border" pAllDesktops = readField allDesktops "allDesktops" pOverrideRedirect = readField overrideRedirect "overrideRedirect"+ pPickBroadest = readField pickBroadest "pickBroadest" pCommands = field commands "commands" readCommands
src/Window.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Window--- Copyright : (c) 2011-13 Jose A. Ortega Ruiz+-- Copyright : (c) 2011-14 Jose A. Ortega Ruiz -- : (c) 2012 Jochen Keil -- License : BSD-style (see LICENSE) --@@ -40,7 +40,7 @@ rootw <- rootWindow d dflt (as,ds) <- textExtents fs "0" let ht = as + ds + 4- r = setPosition (position c) srs (fi ht)+ r = setPosition c (position c) srs (fi ht) win <- newWindow d (defaultScreenOfDisplay d) rootw r (overrideRedirect c) setProperties c d win setStruts r c d win srs@@ -54,13 +54,13 @@ srs <- getScreenInfo d (as,ds) <- textExtents fs "0" let ht = as + ds + 4- r = setPosition (position c) srs (fi ht)+ r = setPosition c (position c) srs (fi ht) moveResizeWindow d win (rect_x r) (rect_y r) (rect_width r) (rect_height r) setStruts r c d win srs return r -setPosition :: XPosition -> [Rectangle] -> Dimension -> Rectangle-setPosition p rs ht =+setPosition :: Config -> XPosition -> [Rectangle] -> Dimension -> Rectangle+setPosition c p rs ht = case p' of Top -> Rectangle rx ry rw h TopP l r -> Rectangle (rx + fi l) ry (rw - fi l - fi r) h@@ -71,11 +71,11 @@ BottomP l r -> Rectangle (rx + fi l) ny (rw - fi l - fi r) h BottomSize a i ch -> Rectangle (ax a i) (ny' ch) (nw i) (mh ch) Static cx cy cw ch -> Rectangle (fi cx) (fi cy) (fi cw) (fi ch)- OnScreen _ p'' -> setPosition p'' [scr] ht+ OnScreen _ p'' -> setPosition c p'' [scr] ht where (scr@(Rectangle rx ry rw rh), p') =- case p of OnScreen i x -> (fromMaybe (broadest rs) $ safeIndex i rs, x)- _ -> (broadest rs, p)+ case p of OnScreen i x -> (fromMaybe (picker rs) $ safeIndex i rs, x)+ _ -> (picker rs, p) ny = ry + fi (rh - ht) center i = rx + fi (div (remwid i) 2) right i = rx + fi (remwid i)@@ -89,7 +89,9 @@ mh h' = max (fi h') h ny' h' = ry + fi (rh - mh h') safeIndex i = lookup i . zip [0..]- broadest = maximumBy (compare `on` rect_width)+ picker = if pickBroadest c+ then maximumBy (compare `on` rect_width)+ else head setProperties :: Config -> Display -> Window -> IO () setProperties c d w = do
src/Xmobar.hs view
@@ -237,7 +237,8 @@ return (Just h,var) where is = s ++ "Updating..." ++ ss -updateString :: Config -> TVar [String] -> IO [[(Widget, String, Maybe [Action])]]+updateString :: Config -> TVar [String] ->+ IO [[(Widget, String, Maybe [Action])]] updateString conf v = do s <- atomically $ readTVar v let l:c:r:_ = s ++ repeat ""
xmobar.cabal view
@@ -1,5 +1,5 @@ name: xmobar-version: 0.20+version: 0.20.1 homepage: http://projects.haskell.org/xmobar/ bug-reports: http://code.google.com/p/xmobar/issues synopsis: A Minimalistic Text Based Status Bar