Post by @rqm

rqm
@rqm
Public en edited

I desperately need an #OpenBSD battery script that gives me a BIG alert when my laptop battery gets down to 5%. I think apmd ought to be able to do this. Has anyone anything? I use i3 btw.

EDIT: I thought it was solved but it isn't.

Replying to @rqm
Hund
@hund @fosstodon.org

@rqm I use upower: `upower -b`. It shows me a lot of useful statistics.

I have a custom widget in Polybar that display the current percentage and remaining time when I'm on battery and when I'm charging it.

Replying to @hund@fosstodon.org

@hund@fosstodon.org Cool! I've got a custom polybar widget as well, calling a little sysctl script. Only thing is I often don't glance at it frequently enough so I really could use an alert. Here's the script btw:

$ cat ~/.scripts/battery.sh 
#!/bin/sh
batt_percent=`sysctl -n hw.sensors.acpisbs0.percent0 | awk '{print $1;}'`
charging=`sysctl -n hw.sensors.acpiac0.indicator0 | awk '{print $1;}'`
if [ "$charging" == "On" ]; then
	echo "$batt_percent+"
else
	echo "$batt_percent"
fi
Replying to @rqm
Hund
@hund @fosstodon.org

@rqm Neat!