This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/env/wm/extras/bar/modules/battery-bm.bash

26 lines
652 B
Bash
Raw Normal View History

#!/usr/bin/env bash
source "$DOTFILES_PATH/variables.bash"
source "$BAR_PATH/colors.bash"
2017-01-18 23:06:36 -06:00
PRIORITY=22000
MATCH_PREFIX="BM_BATTERY"
MATCH="$MATCH_PREFIX*"
bar_module_battery() {
2017-01-18 23:06:36 -06:00
echo -e "%{T-}%{F$COLOR_DARK}bat %{F$COLOR_S2}${1:10}%{F-}"
}
export -f bar_module_battery
bar_module_battery_updater() {
while true; do
2017-01-18 23:06:36 -06:00
# echo -e "$MATCH_PREFIX""$(cat /sys/class/power_supply/BAT*/capacity)" >> "$BAR_LOG"
echo -e "$MATCH_PREFIX""$(cat /sys/class/power_supply/BAT*/capacity)" > "$BAR_FIFO"
sleep 60
done
}
export -f bar_module_battery_updater
2017-01-18 23:06:36 -06:00
register_bar_module "$PRIORITY" "$MATCH" "bar_module_battery" "bar_module_battery_updater"