Battery on Xmobar

2013-10-30 03:20:00 +0000 - Written by Carl Burks

The battery plugin didn’t seem to work:

pacman -S bc

gives me a calculator that I can use to divide the full energy from current energy.

echo "scale=2;$(cat /sys/class/power_supply/BAT0/energy_now)/$(cat /sys/class/power_supply/BAT0/energy_full)"| bc -q

a simple cat of

/sys/class/power_supply/BAT0/status

gives me charging or discharging Heres what I’ve got so far:

~/.xmobarrc


Config {bgColor = "black"
, fgColor = "yellow"
, position = Top
, commands = [    
    Run Com "cat" ["/sys/class/power_supply/BAT0/status"] "battstat" 1000,
    Run Com "battpercentage" [] "battcharge" 1000,
    Run StdinReader
    ]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader%}{%battcharge% %battstat% %date%"
}