Release v2.0.0

This commit is contained in:
Martin Beentjes 2025-12-30 16:13:17 +01:00
parent 5c47191df8
commit 49b627b042
5 changed files with 24 additions and 118 deletions

View file

@ -1,13 +1,20 @@
# Changelog
### master
- Fixed `#{battery_graph}` to actually display graph (@rux616)
- High-granularity icons and colors added. (@rux616)
- Changed preferred order of utility applications to be `pmset` -> `acpi` -> `upower` -> `termux-battery-status` due to CPU usage issues with `upower` (2019-03-05) (@rux616)
- Added `#{battery_status_bg}` feature (@RyanFrantz)
- Added multibattery output support for `upower` (@futuro)
- Added Chromebook support (@forkjoseph)
- Added battery graph, simplify interpolation (@levens)
### v2.0.0, 2025-12-30
- Added `#{battery_charging_watts}` format string for displaying current watts supplied on macOS
- Added `#{battery_color_bg}`, `#{battery_color_fg}` format strings for dynamic color based on charge/status
- Added `#{battery_color_charge_bg}`, `#{battery_color_charge_fg}` for colors based solely on charge level
- Added `#{battery_color_status_bg}`, `#{battery_color_status_fg}` for colors based solely on battery status
- Added `#{battery_icon_charge}`, `#{battery_icon_status}` for granular icon control
- Added 8-tier charge level icons and colors with full customization support
- Added `#{battery_graph}` to display battery as a bar graph
- Added `@batt_remain_short` option to shorten remaining time display
- Added WSL (Windows Subsystem for Linux) support
- Added OpenBSD `apm` support
- Added `battery_enabled.tmux` script for conditionally showing battery
- Fixed battery graph display
- Removed deprecated `#{battery_status_bg}` and `#{battery_status_fg}` format strings
- Changed preferred order of utility applications to: pmset → acpi → upower → termux-battery-status due to CPU usage issues with upower
### v1.2.0, 2016-09-24
- show output for `#{battery_remain}` interpolation only if the battery is

View file

@ -52,7 +52,7 @@ If format strings are added to `status-right`, they should now be visible.
Add any of the supported format strings (see below) to the `status-right` tmux option in `.tmux.conf`. Example:
```tmux
set -g status-right '#{battery_status_bg} Batt: #{battery_icon} #{battery_percentage} #{battery_remain} | %a %h-%d %H:%M '
set -g status-right '#{battery_color_bg} Batt: #{battery_icon} #{battery_percentage} #{battery_remain} | %a %h-%d %H:%M '
```
### Supported Format Strings
@ -69,7 +69,7 @@ set -g status-right '#{battery_status_bg} Batt: #{battery_icon} #{battery_percen
- `#{battery_icon_status}` - will display a battery status icon
- `#{battery_percentage}` - will show battery percentage
- `#{battery_remain}` - will show remaining time of battery charge\*
= `#{battery_charging_watts}` - will display the current watts supplied (currently supported only on OSX)
- `#{battery_charging_watts}` - will display the current watts supplied (currently supported only on macOS)
\* These format strings can be further customized via options as described below.

View file

@ -4,20 +4,19 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"
print_battery_percentage() {
print_battery_charging_watts() {
if is_osx; then
watts=$(system_profiler SPPowerDataType | grep Wattage | awk '{print $3}')
if [ -z $watts];
then
watts="0"
if [ -z "$watts" ]; then
watts="0"
fi
echo "$watts"
else
echo "??"
echo "${watts}W"
else
echo ""
fi
}
main() {
print_battery_percentage
print_battery_charging_watts
}
main

View file

@ -1,50 +0,0 @@
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"
color_full_charge_default="#[bg=green]"
color_high_charge_default="#[bg=yellow]"
color_medium_charge_default="#[bg=colour208]" # orange
color_low_charge_default="#[bg=red]"
color_charging_default="#[bg=green]"
color_full_charge=""
color_high_charge=""
color_medium_charge=""
color_low_charge=""
color_charging=""
get_charge_color_settings() {
color_full_charge=$(get_tmux_option "@batt_color_full_charge" "$color_full_charge_default")
color_high_charge=$(get_tmux_option "@batt_color_high_charge" "$color_high_charge_default")
color_medium_charge=$(get_tmux_option "@batt_color_medium_charge" "$color_medium_charge_default")
color_low_charge=$(get_tmux_option "@batt_color_low_charge" "$color_low_charge_default")
color_charging=$(get_tmux_option "@batt_color_charging" "$color_charging_default")
}
print_battery_status_bg() {
# Call `battery_percentage.sh`.
percentage=$($CURRENT_DIR/battery_percentage.sh | sed -e 's/%//')
status=$(battery_status | awk '{print $1;}')
if [ $status == 'charging' ]; then
printf $color_charging
elif [ $percentage -eq 100 ]; then
printf $color_full_charge
elif [ $percentage -le 99 -a $percentage -ge 51 ];then
printf $color_high_charge
elif [ $percentage -le 50 -a $percentage -ge 16 ];then
printf $color_medium_charge
elif [ "$percentage" == "" ];then
printf $color_full_charge_default # assume it's a desktop
else
printf $color_low_charge
fi
}
main() {
get_charge_color_settings
print_battery_status_bg
}
main

View file

@ -1,50 +0,0 @@
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"
color_full_charge_default="#[fg=green]"
color_high_charge_default="#[fg=yellow]"
color_medium_charge_default="#[fg=colour208]" # orange
color_low_charge_default="#[fg=red]"
color_charging_default="#[fg=green]"
color_full_charge=""
color_high_charge=""
color_medium_charge=""
color_low_charge=""
color_charging=""
get_charge_color_settings() {
color_full_charge=$(get_tmux_option "@batt_color_full_charge" "$color_full_charge_default")
color_high_charge=$(get_tmux_option "@batt_color_high_charge" "$color_high_charge_default")
color_medium_charge=$(get_tmux_option "@batt_color_medium_charge" "$color_medium_charge_default")
color_low_charge=$(get_tmux_option "@batt_color_low_charge" "$color_low_charge_default")
color_charging=$(get_tmux_option "@batt_color_charging" "$color_charging_default")
}
print_battery_status_fg() {
# Call `battery_percentage.sh`.
percentage=$($CURRENT_DIR/battery_percentage.sh | sed -e 's/%//')
status=$(battery_status | awk '{print $1;}')
if [ $status == 'charging' ]; then
printf $color_charging
elif [ $percentage -eq 100 ]; then
printf $color_full_charge
elif [ $percentage -le 99 -a $percentage -ge 51 ];then
printf $color_high_charge
elif [ $percentage -le 50 -a $percentage -ge 16 ];then
printf $color_medium_charge
elif [ "$percentage" == "" ];then
printf $color_full_charge_default # assume it's a desktop
else
printf $color_low_charge
fi
}
main() {
get_charge_color_settings
print_battery_status_fg
}
main