Package: xmobar Version: 0.13-2 The battery plugin uses charge_now and charge_full (or energy_now and energy_full, depending upon what's available) to determine the amount of battery charge remaining. This works most of the time, but battery drivers don't always provide charge_full; some provide charge_full_design instead of (or sometimes in addition to) charge_full. This means the battery plugin is unusable with my XO-1, for example, which uses the olpc-battery driver.
The attached patch changes xmobar's battery plugin to use charge_full_design if charge_full doesn't exist. I've only tested it on my XO-1.. It should be tested on other platforms to ensure no regressions.
Support *_full_design in battery monitor plugin Some battery drivers don't support things like energy_full or charge_full; instead, they use charge_full_design. Change the battery monitor plugin to use *_full_design if *_full doesn't exist but *_full_design does exist. --- --- xmobar-0.13.orig/src/Plugins/Monitors/Batt.hs +++ xmobar-0.13/src/Plugins/Monitors/Batt.hs @@ -95,15 +95,21 @@ batteryFiles bat = is_energy <- fileExist $ prefix </> "energy_now" is_current <- fileExist $ prefix </> "current_now" let cf = if is_current then "current_now" else "power_now" - return $ case (is_charge, is_energy) of - (True, _) -> files "charge" cf - (_, True) -> files "energy" cf + ch = case (is_charge, is_energy) of + (True, _) -> "charge" + (_, True) -> "energy" + _ -> "" + is_full <- fileExist $ prefix </> ch ++ "_full" + is_design <- fileExist $ prefix </> ch ++ "_full_design" + return $ case (is_full, is_design) of + (True, _) -> files ch cf "" + (_, True) -> files ch cf "_design" _ -> NoFiles where prefix = sysDir </> bat - files ch cf = Files { fFull = prefix </> ch ++ "_full" - , fNow = prefix </> ch ++ "_now" - , fCurrent = prefix </> cf - , fVoltage = prefix </> "voltage_now" } + files ch cf des = Files { fFull = prefix </> ch ++ "_full" ++ des + , fNow = prefix </> ch ++ "_now" + , fCurrent = prefix </> cf + , fVoltage = prefix </> "voltage_now" } haveAc :: FilePath -> IO Bool haveAc f = do