skynet/bin/battlvl

11 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)"