diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2014-03-13 20:33:51 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2014-03-13 20:33:51 +0100 |
commit | 04ffb1e36db9b49ffe393ec6bc099a3fe505e3b8 (patch) | |
tree | b55fc1ca3cf9299e47230b7bd5d191b4f7fc9464 | |
parent | 40a2d25767a25dacc4a961f22b023131f86417f8 (diff) | |
download | xmobar-04ffb1e36db9b49ffe393ec6bc099a3fe505e3b8.tar.gz xmobar-04ffb1e36db9b49ffe393ec6bc099a3fe505e3b8.tar.bz2 |
Back to picking first screen by default (#158)0.20.1
-rw-r--r-- | news.md | 10 | ||||
-rw-r--r-- | readme.md | 8 | ||||
-rw-r--r-- | samples/xmobar.config | 1 | ||||
-rw-r--r-- | src/Config.hs | 6 | ||||
-rw-r--r-- | src/Main.hs | 5 | ||||
-rw-r--r-- | src/Parsers.hs | 7 | ||||
-rw-r--r-- | src/Window.hs | 20 | ||||
-rw-r--r-- | src/Xmobar.hs | 3 | ||||
-rw-r--r-- | xmobar.cabal | 2 |
9 files changed, 44 insertions, 18 deletions
@@ -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_ @@ -11,7 +11,7 @@ xmobar was inspired by the [Ion3] status bar, and supports similar 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 @@ -267,6 +267,12 @@ Other configuration options: 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 possible. This option can be toggled at runtime. Defaults to False. diff --git a/samples/xmobar.config b/samples/xmobar.config index 8508741..9c359e3 100644 --- a/samples/xmobar.config +++ b/samples/xmobar.config @@ -5,6 +5,7 @@ Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*" , 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 diff --git a/src/Config.hs b/src/Config.hs index eaf044a..ed3e51a 100644 --- a/src/Config.hs +++ b/src/Config.hs @@ -58,6 +58,9 @@ data Config = , 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 @@ data Config = -- 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 @@ defaultConfig = , persistent = False , allDesktops = True , overrideRedirect = True + , pickBroadest = False , commands = [ Run $ Date "%a %b %_d %Y * %H:%M:%S" "theDate" 10 , Run StdinReader] , sepChar = "%" diff --git a/src/Main.hs b/src/Main.hs index a3c60c3..92573b9 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -175,7 +175,7 @@ usage = usageInfo header options ++ footer 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 @@ license = "\nThis program is distributed in the hope that it will be useful," ++ "\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 @@ doOpts conf (o:oo) = "specified with the -" ++ c:" option\n") readStr str = [x | (x,t) <- reads str, ("","") <- lex t] doOpts' opts = doOpts opts oo - diff --git a/src/Parsers.hs b/src/Parsers.hs index a1d60d8..f25fd4d 100644 --- a/src/Parsers.hs +++ b/src/Parsers.hs @@ -175,12 +175,14 @@ parseConfig = runParser parseConf fields "Config" . stripComments 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 @@ parseConfig = runParser parseConf fields "Config" . stripComments pBorder = readField border "border" pAllDesktops = readField allDesktops "allDesktops" pOverrideRedirect = readField overrideRedirect "overrideRedirect" + pPickBroadest = readField pickBroadest "pickBroadest" pCommands = field commands "commands" readCommands diff --git a/src/Window.hs b/src/Window.hs index 3fdb923..876b7a2 100644 --- a/src/Window.hs +++ b/src/Window.hs @@ -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 @@ createWin d fs c = do 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 @@ repositionWin d win fs c = do 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 @@ setPosition p rs ht = 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 @@ setPosition p rs ht = 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 diff --git a/src/Xmobar.hs b/src/Xmobar.hs index ce32a0a..c126b7c 100644 --- a/src/Xmobar.hs +++ b/src/Xmobar.hs @@ -237,7 +237,8 @@ startCommand sig (com,s,ss) 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 "" diff --git a/xmobar.cabal b/xmobar.cabal index 9ae14a2..ba5c0ee 100644 --- a/xmobar.cabal +++ b/xmobar.cabal @@ -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 |