This repository has been archived on 2025-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
inks-scripts/scripts/bash-status-bat

13 lines
354 B
Bash
Executable File

#!/bin/bash
[[ "$(upower -i $(upower -e | grep 'BAT'))" == "" ]] && exit
current=$(upower -i $(upower -e | grep 'BAT') | grep -E "percentage" | sed 's/.*://' | sed 's/ *//')
state=$(upower -i $(upower -e | grep 'BAT') | grep -E "state" | sed 's/.*://' | sed 's/ *//')
if [[ "$state" == "not charging" ]]; then
state="full"
fi
echo "$current $state"