Looking for the battery bar I used to have

museur

New Member


Messages: 18

I've used to use a simple bar for status of battery on my laptop. It was a simple monitor wide bar, buttom of the screen indicating percentage with colors that displayed information when you hover your pointer on it.

I do not remember what the package was named. I tried the ones I thought may be... Does anyone know what was it called?

Thank you!
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,135
Messages: 33,711

Can you remember the windows manager or desktop environment you were running? It may have been part of those. Or at least it might provide some clues.
 

Elazar

Well-Known Member

Reaction score: 129
Messages: 311

Vermaden used dzen2 as a status bar. It would display the battery life.

pkg search bat returns a couple of packages, e.g. batmon, battmond, battray, dsbbatmon, xbatt, xfce4-battery-plugin
 
OP
M

museur

New Member


Messages: 18

I was using bspwm and i still do. I've tried those returning from searching bat and battery, it may be xbattbar but I couldn't install it.
 

bookwormep

Well-Known Member

Reaction score: 186
Messages: 323

There is a battery monitor on 'tint2', but you have to manually configure the default settings.
(Especially if you want color text to appear.)
 
OP
M

museur

New Member


Messages: 18

I don't really see the point of using a bar except battery status. I'll check it out, thanks.
 

memreflect

Active Member

Reaction score: 73
Messages: 115

If I remember correctly, x11/polybar also comes with a battery status monitor. If you've used the x11-wm/i3 window manager before, i3bar comes with it, and it has a battery monitor. Whether they work in FreeBSD or not, I have no idea, but those were the two I used when I used Linux.
 

aragats

Daemon

Reaction score: 604
Messages: 1,502

You can write your own script to display a battery bar using x11/dzen2.
I'm using a simple one, but you can easily extend it by adding extra info and processing mouse clicks:
Code:
#!/bin/sh

BG=midnightblue  # dzen backgrounad
FG=white         # dzen foreground
W=72             # width of the dzen bar
SW=100           # width of slave window - not used yet
H=22             # height of the dzen bar
GW=24            # gauge width
GH=8             # gauge height
GBG='#9999dd'    # gauge background color
Y=0              # y position
X=1000           # x position
FN="dejaVu sans mono:pixelsize=12"

STAT_CMD='acpiconf -i 0'
TMP_FILE=/tmp/battery.stat

CRT_BAT=15        # critical percentage of battery
LOW_BAT=25        # low percentage of battery
LOW_COL='#ff4747' # color when battery is low
NOR_COL='#22aa22' # normal gauge color
CHG_COL='#007eff' # color when battery is charging
TIME_INT=2        # time intervall in seconds

while true; do
        $STAT_CMD > $TMP_FILE
        STATE=`sed -n 's/State:[^a-z]*\(.*\)/\1/p' $TMP_FILE `
        RCAP=`sed -n 's/Remaining\ capacity:[^0-9]*\([0-9]*\)[^0-9]*/\1/p' $TMP_FILE `

        if [ $STATE != "discharging" ] ; then
                GFG=$CHG_COL
        elif [ $RCAP -le $LOW_BAT ] ; then
                GFG=$LOW_COL
                # suspend if very low:
                if [ $RCAP -le $CRIT_BAT ] ; then
                        sudo acpiconf -s 3
                fi
        else
                GFG=$NOR_COL
        fi

        echo -n \ $RCAP\%
        eval echo -n $RCAP | gdbar -s o -h $GH -w $GW -fg $GFG -bg $GBG | sed 's/^\ */\ /'

        sleep $TIME_INT;
done | dzen2 -x $X -y $Y -tw $W -h $H -fg $FG -bg $BG -fn "$FN" -e ''
 
Top