diff options
author | jao <jao@gnu.org> | 2018-02-18 22:38:51 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2018-02-18 22:38:51 +0100 |
commit | e154d88e03e05b2dad34408b05ed944024036ba5 (patch) | |
tree | a49a3f706413af4f93a077254b762901ba50d998 /src/Plugins | |
parent | 3aed229c30d1562f0e29748a78362cdd3722ae20 (diff) | |
download | xmobar-e154d88e03e05b2dad34408b05ed944024036ba5.tar.gz xmobar-e154d88e03e05b2dad34408b05ed944024036ba5.tar.bz2 |
Batt: Try also "BAT" (fixes #338)
Diffstat (limited to 'src/Plugins')
-rw-r--r-- | src/Plugins/Monitors/Batt.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs index 0469ac2..eeeb049 100644 --- a/src/Plugins/Monitors/Batt.hs +++ b/src/Plugins/Monitors/Batt.hs @@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Plugins.Monitors.Batt --- Copyright : (c) 2010, 2011, 2012, 2013, 2015, 2016 Jose A Ortega +-- Copyright : (c) 2010, 2011, 2012, 2013, 2015, 2016, 2018 Jose A Ortega -- (c) 2010 Andrea Rossato, Petr Rockai -- License : BSD-style (see LICENSE) -- @@ -107,7 +107,7 @@ data Files = Files , fCurrent :: String , fStatus :: String , isCurrent :: Bool - } | NoFiles + } | NoFiles deriving Eq data Battery = Battery { full :: !Float @@ -174,7 +174,8 @@ 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) + do let bfs' = filter (/= NoFiles) bfs + bats <- mapM (readBattery (scale opts)) (take 3 bfs') ac <- haveAc (onlineFile opts) let sign = if ac then 1 else -1 ft = sum (map full bats) @@ -194,7 +195,7 @@ readBatteries opts bfs = return $ if isNaN left then NA else Result left watts time racst runBatt :: [String] -> Monitor String -runBatt = runBatt' ["BAT0","BAT1","BAT2"] +runBatt = runBatt' ["BAT", "BAT0", "BAT1", "BAT2"] runBatt' :: [String] -> [String] -> Monitor String runBatt' bfs args = do |