Hello community,

here is the log from the commit of package xmobar for openSUSE:Factory checked 
in at 2016-10-23 12:51:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xmobar (Old)
 and      /work/SRC/openSUSE:Factory/.xmobar.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "xmobar"

Changes:
--------
--- /work/SRC/openSUSE:Factory/xmobar/xmobar.changes    2016-08-25 
09:57:34.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.xmobar.new/xmobar.changes       2016-10-23 
12:51:20.000000000 +0200
@@ -1,0 +2,5 @@
+Fri Sep 16 21:22:50 UTC 2016 - [email protected]
+
+- Update to version 0.24.3 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  xmobar-0.24.2.tar.gz

New:
----
  xmobar-0.24.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ xmobar.spec ++++++
--- /var/tmp/diff_new_pack.jT0zEo/_old  2016-10-23 12:51:22.000000000 +0200
+++ /var/tmp/diff_new_pack.jT0zEo/_new  2016-10-23 12:51:22.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           xmobar
-Version:        0.24.2
+Version:        0.24.3
 Release:        0
 Summary:        A Minimalistic Text Based Status Bar
 License:        BSD-3-Clause

++++++ xmobar-0.24.2.tar.gz -> xmobar-0.24.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xmobar-0.24.2/news.md new/xmobar-0.24.3/news.md
--- old/xmobar-0.24.2/news.md   2016-08-08 23:40:59.000000000 +0200
+++ new/xmobar-0.24.3/news.md   2016-09-05 17:49:18.000000000 +0200
@@ -1,5 +1,14 @@
 % xmobar - Release notes
 
+## Version 0.24.3 (Sep 5, 2016)
+
+_Bug fixes_
+
+  - Battery monitor: fixes for cases where status is not consistently
+    reported by the kernel (see [issue #271]).
+
+[issue #271]: https://github.com/jaor/xmobar/issues/271
+
 ## Version 0.24.2 (Aug 8, 2016)
 
 _Bug fixes_
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xmobar-0.24.2/readme.md new/xmobar-0.24.3/readme.md
--- old/xmobar-0.24.2/readme.md 2016-08-08 23:40:59.000000000 +0200
+++ new/xmobar-0.24.3/readme.md 2016-09-05 17:49:18.000000000 +0200
@@ -10,7 +10,7 @@
 features, like dynamic color management, icons, output templates, and
 extensibility through plugins.
 
-This page documents xmobar 0.24.2 (see [release notes]).
+This page documents xmobar 0.24.3 (see [release notes]).
 
 [This screenshot] shows xmobar running under [sawfish], with
 antialiased fonts. And [this one] is my desktop with [xmonad] and two
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xmobar-0.24.2/src/Plugins/Monitors/Batt.hs 
new/xmobar-0.24.3/src/Plugins/Monitors/Batt.hs
--- old/xmobar-0.24.2/src/Plugins/Monitors/Batt.hs      2016-08-08 
23:40:59.000000000 +0200
+++ new/xmobar-0.24.3/src/Plugins/Monitors/Batt.hs      2016-09-05 
17:49:18.000000000 +0200
@@ -147,7 +147,7 @@
   where onError = const (return False) :: SomeException -> IO Bool
 
 readBattery :: Float -> Files -> IO Battery
-readBattery _ NoFiles = return $ Battery 0 0 0 "Idle"
+readBattery _ NoFiles = return $ Battery 0 0 0 "Unknown"
 readBattery sc files =
     do a <- grab $ fFull files
        b <- grab $ fNow files
@@ -162,13 +162,16 @@
     where grab f = handle onError $ withFile f ReadMode (fmap read . hGetLine)
           onError = const (return (-1)) :: SomeException -> IO Float
           grabs f = handle onError' $ withFile f ReadMode hGetLine
-          onError' = const (return "Idle") :: SomeException -> IO String
+          onError' = const (return "Unknown") :: SomeException -> IO String
 
 -- sortOn is only available starting at ghc 7.10
 sortOn :: Ord b => (a -> b) -> [a] -> [a]
 sortOn f =
   map snd . sortBy (comparing fst) . map (\x -> let y = f x in y `seq` (y, x))
 
+mostCommonDef :: Eq a => a -> [a] -> a
+mostCommonDef x xs = head $ last $ [x] : sortOn length (group xs)
+
 readBatteries :: BattOpts -> [Files] -> IO Result
 readBatteries opts bfs =
     do bats <- mapM (readBattery (scale opts)) (take 3 bfs)
@@ -183,8 +186,12 @@
            statuses :: [Status]
            statuses = map (fromMaybe Unknown . readMaybe)
                           (sort (map status bats))
-           acst = head $ last $ sortOn length (group statuses)
-       return $ if isNaN left then NA else Result left watts time acst
+           acst = mostCommonDef Unknown $ filter (Unknown/=) statuses
+           racst | acst /= Unknown = acst
+                 | time == 0 = Idle
+                 | ac = Charging
+                 | otherwise = Discharging
+       return $ if isNaN left then NA else Result left watts time racst
 
 runBatt :: [String] -> Monitor String
 runBatt = runBatt' ["BAT0","BAT1","BAT2"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xmobar-0.24.2/xmobar.cabal 
new/xmobar-0.24.3/xmobar.cabal
--- old/xmobar-0.24.2/xmobar.cabal      2016-08-08 23:40:59.000000000 +0200
+++ new/xmobar-0.24.3/xmobar.cabal      2016-09-05 17:49:18.000000000 +0200
@@ -1,5 +1,5 @@
 name:               xmobar
-version:            0.24.2
+version:            0.24.3
 homepage:           http://xmobar.org
 synopsis:           A Minimalistic Text Based Status Bar
 description:       Xmobar is a minimalistic text based status bar.


Reply via email to