@@ -8,13 +8,20 @@ source "$CURRENT_DIR/helpers.sh"
8
8
charged_icon=" "
9
9
charging_icon=" "
10
10
attached_icon=" "
11
- discharging_icon=" "
11
+ # discharging_icon=""
12
+ full_charge_icon=" "
13
+ high_charge_icon=" "
14
+ medium_charge_icon=" "
15
+ low_charge_icon=" "
12
16
13
17
charged_default=" ❇ "
14
18
charged_default_osx=" 🔋 "
15
19
charging_default=" ⚡️ "
16
20
attached_default=" ⚠️ "
17
- discharging_default=" "
21
+ full_charge_icon_default=" 🌕 "
22
+ high_charge_icon_default=" 🌖 "
23
+ medium_charge_icon_default=" 🌗 "
24
+ low_charge_icon_default=" 🌘 "
18
25
19
26
charged_default () {
20
27
if is_osx; then
@@ -29,7 +36,10 @@ get_icon_settings() {
29
36
charged_icon=$( get_tmux_option " @batt_charged_icon" " $( charged_default) " )
30
37
charging_icon=$( get_tmux_option " @batt_charging_icon" " $charging_default " )
31
38
attached_icon=$( get_tmux_option " @batt_attached_icon" " $attached_default " )
32
- discharging_icon=$( get_tmux_option " @batt_discharging_icon" " $discharging_default " )
39
+ full_charge_icon=$( get_tmux_option " @batt_full_charge_icon" " $full_charge_icon_default " )
40
+ high_charge_icon=$( get_tmux_option " @batt_high_charge_icon" " $high_charge_icon_default " )
41
+ medium_charge_icon=$( get_tmux_option " @batt_medium_charge_icon" " $medium_charge_icon_default " )
42
+ low_charge_icon=$( get_tmux_option " @batt_low_charge_icon" " $low_charge_icon_default " )
33
43
}
34
44
35
45
print_icon () {
@@ -39,7 +49,19 @@ print_icon() {
39
49
elif [[ $status =~ (^charging) ]]; then
40
50
printf " $charging_icon "
41
51
elif [[ $status =~ (^discharging) ]]; then
42
- printf " $discharging_icon "
52
+ # use code from the bg color
53
+ percentage=$( $CURRENT_DIR /battery_percentage.sh | sed -e ' s/%//' )
54
+ if [ $percentage -eq 100 ]; then
55
+ printf $full_charge_icon
56
+ elif [ $percentage -le 99 -a $percentage -ge 51 ]; then
57
+ printf $high_charge_icon
58
+ elif [ $percentage -le 50 -a $percentage -ge 16 ]; then
59
+ printf $medium_charge_icon
60
+ elif [ " $percentage " == " " ]; then
61
+ printf $full_charge_icon_default # assume it's a desktop
62
+ else
63
+ printf $low_charge_icon
64
+ fi
43
65
elif [[ $status =~ (attached) ]]; then
44
66
printf " $attached_icon "
45
67
fi
0 commit comments