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
Daniel Flanagan af80f833d1 more changes!
2017-01-18 23:06:36 -06:00

26 lines
652 B
Bash

#!/usr/bin/env bash
source "$DOTFILES_PATH/variables.bash"
source "$BAR_PATH/colors.bash"
PRIORITY=22000
MATCH_PREFIX="BM_BATTERY"
MATCH="$MATCH_PREFIX*"
bar_module_battery() {
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
# 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
register_bar_module "$PRIORITY" "$MATCH" "bar_module_battery" "bar_module_battery_updater"