mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-09 18:29:41 +00:00
Allow AC adapter naming in battery script
This commit is contained in:
parent
40094c9628
commit
29583e07b7
|
@ -10,19 +10,18 @@ source "./scripts/include"
|
|||
CAPACITY_ICONS=("" "" "" "" "" "" "" "" "" "")
|
||||
CHARGING_ICON=""
|
||||
DISCHARGING_ICON=""
|
||||
FULL_ICON="" # Plugged in, but no longer charging (fully charged)
|
||||
FULL_ICON="" # Plugged in, but no longer charging (fully charged)
|
||||
CRITICAL_ICON=""
|
||||
CRITICAL_PERCENTAGE=15
|
||||
|
||||
|
||||
if [ -z "$BATTERY" ]; then
|
||||
# shellcheck disable=SC2010
|
||||
BATTERY="$(ls -t /sys/class/power_supply | grep "BAT" | head -n 1)"
|
||||
BATTERY="$(\ls -t /sys/class/power_supply | grep "BAT" | head -n 1)"
|
||||
fi
|
||||
|
||||
if [ -z "$ADAPTER" ]; then
|
||||
# shellcheck disable=SC2010
|
||||
ADAPTER="$(ls -t /sys/class/power_supply | grep "ADP" | head -n 1)"
|
||||
ADAPTER="$(\ls -t /sys/class/power_supply | grep -E "ADP|AC" | head -n 1)"
|
||||
fi
|
||||
|
||||
get_bat_info() {
|
||||
|
@ -52,7 +51,6 @@ status="$(get_bat_info status)"
|
|||
# status="Not charging"
|
||||
# status="Discharging"
|
||||
|
||||
|
||||
full="false"
|
||||
capacity_icon="$(pick_icon "$capacity" 0 100 "${CAPACITY_ICONS[@]}")"
|
||||
|
||||
|
@ -69,7 +67,6 @@ fi
|
|||
|
||||
[ "$capacity" -le "$CRITICAL_PERCENTAGE" ] && critical="true" || critical="false"
|
||||
|
||||
|
||||
jq -n -c --monochrome-output \
|
||||
--arg percent "$capacity" \
|
||||
--arg plugged "$adp_connected" \
|
||||
|
|
Loading…
Reference in a new issue