thinkpad tmux battery status

Categories: General, Linux, OS, Script

so i realized that with the setup i have that i did not have a detailed battery indicator on my thinkpad except for the battery light, so i decided to use acpi (gentoo: sys-power/acpi, or sourceforge).

by just typing acpi (with the laptop unplugged) you get :
Battery 0: Discharging, 99%, 02:58:51 remaining

while plugged in (says unknown since it is not charging while at 99%):
Battery 0: Unknown, 99%

here it is with a charging message:
Battery 0: Charging, 93%, 00:11:07 until charged

so i changed my right status bar from:
set -g status-right '#[fg=red]Up #(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") #[fg=black]#[fg=yellow]#(cut -d " " -f 1-4 /proc/loadavg) #[fg=cyan,bold]%Y-%m-%d %H:%M:%S#[default]'

set -g status-right '#[fg=green,bold]#(acpi -V | head -n 1 ) #[fg=red,bold]#(cut -d " " -f 1-4 /proc/loadavg) #[fg=cyan,bold]%Y-%m-%d %H:%M:%S#[default]'

which looks like:

in green bold is acpi
in red bold is cut -d " " -f 1-4 /proc/loadavg
in cyan bold is %Y-%m-%d %H:%M:%S

link to my tmux.conf at github


    Leave a Reply

    Your email address will not be published. Required fields are marked *