From b4a556734100b2116db5788ad25eb5f4e97c4cff Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 12 Jan 2016 15:34:04 -0600 Subject: [PATCH] added pacaur updates module --- wm/extras/bar/formatter.bash | 14 ++++++++--- wm/extras/bar/modules/bspwm-bm.bash | 2 +- wm/extras/bar/modules/clock-bm.bash | 4 ++-- wm/extras/bar/modules/date-bm.bash | 7 +++--- wm/extras/bar/modules/pacaur-updates-bm.bash | 25 ++++++++++++++++++++ 5 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 wm/extras/bar/modules/pacaur-updates-bm.bash diff --git a/wm/extras/bar/formatter.bash b/wm/extras/bar/formatter.bash index f0a2a67..59dd4f6 100755 --- a/wm/extras/bar/formatter.bash +++ b/wm/extras/bar/formatter.bash @@ -34,13 +34,21 @@ while read -r line; do fi done - content="" + l_content="" + c_content="" + r_content="" for i in ${!MODULE_CONTENT[@]}; do echo -e "Processing Module $i Content..." >> "$BAR_LOG" - content="$content ${MODULE_CONTENT[$i]}" + if [ $i -ge 30000 ]; then + r_content="$content ${MODULE_CONTENT[$i]}" + elif [ $i -ge 20000 ]; then + c_content="$content ${MODULE_CONTENT[$i]}" + else + l_content="$content ${MODULE_CONTENT[$i]}" + fi done - printf " %s \n" "$content" + printf " %s \n" "%{l}$l_content %{c}$c_content %{r}$r_content" done echo -e "\nEND BAR LOG" >> "$BAR_LOG" diff --git a/wm/extras/bar/modules/bspwm-bm.bash b/wm/extras/bar/modules/bspwm-bm.bash index cbd7ce5..b5871fb 100644 --- a/wm/extras/bar/modules/bspwm-bm.bash +++ b/wm/extras/bar/modules/bspwm-bm.bash @@ -3,7 +3,7 @@ source "$DOTFILES_PATH/variables.bash" source "$DOTFILES_PATH/wm/extras/bar/colors.bash" -PRIORITY=2500 +PRIORITY=25000 MATCH_PREFIX="W" MATCH="$MATCH_PREFIX*" diff --git a/wm/extras/bar/modules/clock-bm.bash b/wm/extras/bar/modules/clock-bm.bash index b61b8c1..42c674c 100644 --- a/wm/extras/bar/modules/clock-bm.bash +++ b/wm/extras/bar/modules/clock-bm.bash @@ -3,13 +3,13 @@ source "$DOTFILES_PATH/variables.bash" source "$DOTFILES_PATH/wm/extras/bar/colors.bash" -PRIORITY=3800 +PRIORITY=38000 MATCH_PREFIX="BM_CLOCK" MATCH="$MATCH_PREFIX*" bar_module_clock() { - echo -e "%{T-}%{r}%{F$COLOR_S1}${1:8}%{F-}" + echo -e "%{T-}%{F$COLOR_S1}${1:8}%{F-}" } export -f bar_module_clock diff --git a/wm/extras/bar/modules/date-bm.bash b/wm/extras/bar/modules/date-bm.bash index 26ff850..4197abb 100644 --- a/wm/extras/bar/modules/date-bm.bash +++ b/wm/extras/bar/modules/date-bm.bash @@ -3,13 +3,14 @@ source "$DOTFILES_PATH/variables.bash" source "$DOTFILES_PATH/wm/extras/bar/colors.bash" -PRIORITY=3500 +PRIORITY=35000 MATCH_PREFIX="BM_DATE" MATCH="$MATCH_PREFIX*" bar_module_date() { - echo -e "%{T-}%{r}%{F$COLOR_S2}${1:7}%{F-}" + echo -e "$1 " + # echo -e "%{T-}%{r}%{F$COLOR_S2}${1:7}%{F-}" } export -f bar_module_date @@ -17,7 +18,7 @@ register_bar_module "$PRIORITY" "$MATCH" "bar_module_date" bar_module_date_updater() { while true; do - echo -e "$MATCH_PREFIX""$(date +"%a %b %d")" > $BAR_FIFO + echo -e "$MATCH_PREFIX""$(date +'%a %b %d')" > $BAR_FIFO sleep 1 done } diff --git a/wm/extras/bar/modules/pacaur-updates-bm.bash b/wm/extras/bar/modules/pacaur-updates-bm.bash new file mode 100644 index 0000000..42c674c --- /dev/null +++ b/wm/extras/bar/modules/pacaur-updates-bm.bash @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +source "$DOTFILES_PATH/variables.bash" +source "$DOTFILES_PATH/wm/extras/bar/colors.bash" + +PRIORITY=38000 + +MATCH_PREFIX="BM_CLOCK" +MATCH="$MATCH_PREFIX*" + +bar_module_clock() { + echo -e "%{T-}%{F$COLOR_S1}${1:8}%{F-}" +} + +export -f bar_module_clock +register_bar_module "$PRIORITY" "$MATCH" "bar_module_clock" + +bar_module_clock_updater() { + while true; do + echo -e "$MATCH_PREFIX""$(date +%H.%M.%S)" > $BAR_FIFO + sleep 1 + done +} +bar_module_clock_updater & +