lbarchive/READYT

xbatter bar duo and tmux-batterylife

Closed this issue · 0 comments

Note: Due the length restriction, I needed to split this video's description and put it here.

THREE BATTERY BARS

xbattbar duo

The original xbattbar and Haskell rewritten xbattbar have same basic options. You can use the following options -- from original -h:

-a:         always on top.
-v, -h:     show this message.
-t:         bar (indicator) thickness. [def: 3 pixels]
-p:         polling interval. [def: 10 sec.]
-I, -O:     bar colors in AC on-line. [def: "green" & "olive drab"]
-i, -o:     bar colors in AC off-line. [def: "blue" and "red"]
top, bottom, left, right: bar localtion. [def: "bottom"]

As you can see, you can change the colors and location of the bar. They both also provide overlay for remaining power at center of screen if you hover over the bar. The Haskell one even pops up when the battery power becomes too low, but the original calculates the ETAs of remaining power and of fully charged.

The original actually relies on one of three external scripts to grab battery data from -c ACPI, APM (default), or -r sysfs. Or you can use -s to write your own script.

For sysfs, its paths are outdated, I used the following:

#!/usr/bin/python

with open("/sys/bus/acpi/drivers/ac/ACPI0003:00/power_supply/AC/online") as fp:
    ac = fp.read(1)
ac = {'0':'off','1':'on'}[ac]

with open("/sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT0//charge_now") as fp:
    now = int(fp.read())
with open("/sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT0//charge_full") as fp:
    full = int(fp.read())
now = full if now > full else now
battery = now * 100 / full

print "battery=%d\nac_line=%s\n"%(battery,ac)

Same thing happened to the Haskell version, it used energy_now, I had to edited and re-built.

tmux-batterylife

tmux-batterylife has three colors for hearts, red for charged, white for not charged, and black for the gap between maximum charged and designed fully charged.

I don't use tmux's status bar, but for this project I had it turned back on. Frankly, I don't understand why many people want to overcrowd their tmux status and shell prompt (such as time and VCS status). I had used them, then realized that keeping your workspace as clean and as simple is a better way to work. As for system monitor, you already has a bar section somewhere, especially if you use major DE (Desktop Environment). No need to put another clock in tmux, certainly not the battery power. However, if truly has single maximized window, that is no other top bar or anything, then this is one to have, you need to know the battery power when it's not on AC power.