mirror of
https://github.com/kforney/pentest-distro-builder.git
synced 2025-02-05 07:27:58 -07:00
54 lines
1.2 KiB
Bash
54 lines
1.2 KiB
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||
|
|
||
|
source "$CURRENT_DIR/helpers.sh"
|
||
|
|
||
|
# script global variables
|
||
|
charged_icon=""
|
||
|
charging_icon=""
|
||
|
attached_icon=""
|
||
|
discharging_icon=""
|
||
|
|
||
|
charged_default="❇ "
|
||
|
charged_default_osx="🔋 "
|
||
|
charging_default="⚡️ "
|
||
|
attached_default="⚠️ "
|
||
|
discharging_default=""
|
||
|
|
||
|
charged_default() {
|
||
|
if is_osx; then
|
||
|
echo "$charged_default_osx"
|
||
|
else
|
||
|
echo "$charged_default"
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
# icons are set as script global variables
|
||
|
get_icon_settings() {
|
||
|
charged_icon=$(get_tmux_option "@batt_charged_icon" "$(charged_default)")
|
||
|
charging_icon=$(get_tmux_option "@batt_charging_icon" "$charging_default")
|
||
|
attached_icon=$(get_tmux_option "@batt_attached_icon" "$attached_default")
|
||
|
discharging_icon=$(get_tmux_option "@batt_discharging_icon" "$discharging_default")
|
||
|
}
|
||
|
|
||
|
print_icon() {
|
||
|
local status=$1
|
||
|
if [[ $status =~ (charged) ]]; then
|
||
|
printf "$charged_icon"
|
||
|
elif [[ $status =~ (^charging) ]]; then
|
||
|
printf "$charging_icon"
|
||
|
elif [[ $status =~ (^discharging) ]]; then
|
||
|
printf "$discharging_icon"
|
||
|
elif [[ $status =~ (attached) ]]; then
|
||
|
printf "$attached_icon"
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
main() {
|
||
|
get_icon_settings
|
||
|
local status=$(battery_status)
|
||
|
print_icon "$status"
|
||
|
}
|
||
|
main
|