mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-14 04:07:18 +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=("" "" "" "" "" "" "" "" "" "")
|
CAPACITY_ICONS=("" "" "" "" "" "" "" "" "" "")
|
||||||
CHARGING_ICON=""
|
CHARGING_ICON=""
|
||||||
DISCHARGING_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_ICON=""
|
||||||
CRITICAL_PERCENTAGE=15
|
CRITICAL_PERCENTAGE=15
|
||||||
|
|
||||||
|
|
||||||
if [ -z "$BATTERY" ]; then
|
if [ -z "$BATTERY" ]; then
|
||||||
# shellcheck disable=SC2010
|
# 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
|
fi
|
||||||
|
|
||||||
if [ -z "$ADAPTER" ]; then
|
if [ -z "$ADAPTER" ]; then
|
||||||
# shellcheck disable=SC2010
|
# 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
|
fi
|
||||||
|
|
||||||
get_bat_info() {
|
get_bat_info() {
|
||||||
|
@ -52,7 +51,6 @@ status="$(get_bat_info status)"
|
||||||
# status="Not charging"
|
# status="Not charging"
|
||||||
# status="Discharging"
|
# status="Discharging"
|
||||||
|
|
||||||
|
|
||||||
full="false"
|
full="false"
|
||||||
capacity_icon="$(pick_icon "$capacity" 0 100 "${CAPACITY_ICONS[@]}")"
|
capacity_icon="$(pick_icon "$capacity" 0 100 "${CAPACITY_ICONS[@]}")"
|
||||||
|
|
||||||
|
@ -69,7 +67,6 @@ fi
|
||||||
|
|
||||||
[ "$capacity" -le "$CRITICAL_PERCENTAGE" ] && critical="true" || critical="false"
|
[ "$capacity" -le "$CRITICAL_PERCENTAGE" ] && critical="true" || critical="false"
|
||||||
|
|
||||||
|
|
||||||
jq -n -c --monochrome-output \
|
jq -n -c --monochrome-output \
|
||||||
--arg percent "$capacity" \
|
--arg percent "$capacity" \
|
||||||
--arg plugged "$adp_connected" \
|
--arg plugged "$adp_connected" \
|
||||||
|
|
Loading…
Reference in a new issue