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/wm/extras/bar/modules/pacaur-updates-bm.bash

32 lines
753 B
Bash
Raw Normal View History

2016-01-12 15:34:04 -06:00
#!/usr/bin/env bash
source "$DOTFILES_PATH/variables.bash"
source "$DOTFILES_PATH/wm/extras/bar/colors.bash"
2016-01-12 15:41:12 -06:00
PRIORITY=12000
2016-01-12 15:34:04 -06:00
2016-01-12 15:41:12 -06:00
MATCH_PREFIX="BM_PACAUR"
2016-01-12 15:34:04 -06:00
MATCH="$MATCH_PREFIX*"
2016-01-12 15:41:12 -06:00
bar_module_pacaur() {
echo -e "%{T-}%{F$COLOR_DARK}pac %{F$COLOR_S1}${1:9}%{F-}"
2016-01-12 15:34:04 -06:00
}
2016-01-12 15:41:12 -06:00
export -f bar_module_pacaur
2016-01-12 15:34:04 -06:00
2016-01-12 15:41:12 -06:00
bar_module_pacaur_updater() {
2016-01-12 15:34:04 -06:00
while true; do
if [ -e "/var/lib/pacman/db.lck" ]; then
sleep 10
else
NUM_PACKAGES=$(pacaur -Syq --silent >/dev/null 2>/dev/null && pacaur -Qqu | wc -l)
echo -e "$MATCH_PREFIX""$NUM_PACKAGES" > "$BAR_FIFO"
sleep 300
fi
2016-01-12 15:34:04 -06:00
done
}
2016-07-27 08:57:56 -05:00
export -f bar_module_pacaur_updater
register_bar_module "$PRIORITY" "$MATCH" "bar_module_pacaur" "bar_module_pacaur_updater"
2016-01-12 15:34:04 -06:00
2016-01-12 15:41:12 -06:00
echo -e "$MATCH_PREFIX"?? > "$BAR_FIFO"