skynet/bin/battlvl

10 lines
363 B
Bash
Executable file

#!/bin/sh
# battery percentage
battpct="$(upower --show-info $(upower --enumerate | grep -i 'BAT') | grep -E "percentage" | awk '{print $2}')"
battpct="${battpct%\%}"
# battery status (charging/charged/etc)
batstat="$(upower --show-info $(upower --enumerate | grep -i 'BAT') | grep -E "state" | awk '{print $2}')"
notify-send "Battery: ${battpct}% ($batstat)"