more changes!

This commit is contained in:
Daniel Flanagan 2017-01-18 23:06:36 -06:00
parent 0e4795a4cb
commit af80f833d1
4 changed files with 17 additions and 18 deletions

View file

@ -32,7 +32,7 @@ register_bar_module() {
TYPE_RBM="$(type -t ${MODULE_INIT[$1]})" TYPE_RBM="$(type -t ${MODULE_INIT[$1]})"
TYPE_RBM2="$(type -t ${MODULE_INIT[$3]})" TYPE_RBM2="$(type -t ${MODULE_INIT[$3]})"
echo "-----> - $TYPE_RBM - $TYPE_RBM2 -" >> "$BAR_LOG" # echo "-----> - $TYPE_RBM - $TYPE_RBM2 -" >> "$BAR_LOG"
${MODULE_INIT[$1]} & ${MODULE_INIT[$1]} &
PID=$! PID=$!
echo $PID > "$BAR_PATH/modules/$3.pid" echo $PID > "$BAR_PATH/modules/$3.pid"
@ -41,7 +41,7 @@ register_bar_module() {
export -f register_bar_module export -f register_bar_module
for f in "$BAR_PATH/modules/"*-bm.bash; do for f in "$BAR_PATH/modules/"*-bm.bash; do
for bl in "$BLACKLISTED_BAR_MODULES"; do for bl in $BLACKLISTED_BAR_MODULES; do
if [[ "$f" = "$BAR_PATH/modules/""${bl}"-bm.bash ]]; then if [[ "$f" = "$BAR_PATH/modules/""${bl}"-bm.bash ]]; then
f="" f=""
fi fi
@ -53,7 +53,7 @@ for f in "$BAR_PATH/modules/"*-bm.bash; do
done done
while read -r line; do while read -r line; do
echo -e "Bar Line: $line" >> "$BAR_LOG" # echo -e "Bar Line: $line" >> "$BAR_LOG"
for i in ${!MODULE_MATCH[@]}; do for i in ${!MODULE_MATCH[@]}; do
# echo ${!MODULE_MATCH[@]} >> $BAR_LOG # echo ${!MODULE_MATCH[@]} >> $BAR_LOG
if [[ $line == ${MODULE_MATCH[$i]} ]]; then if [[ $line == ${MODULE_MATCH[$i]} ]]; then

View file

@ -3,25 +3,23 @@
source "$DOTFILES_PATH/variables.bash" source "$DOTFILES_PATH/variables.bash"
source "$BAR_PATH/colors.bash" source "$BAR_PATH/colors.bash"
PRIORITY=31000 PRIORITY=22000
MATCH_PREFIX="BM_BATTERY" MATCH_PREFIX="BM_BATTERY"
MATCH="$MATCH_PREFIX*" MATCH="$MATCH_PREFIX*"
bar_module_battery() { bar_module_battery() {
echo -e "%{T-}%{F$COLOR_DARK}bat %{F$COLOR_S3}${1:10}%{F-}" echo -e "%{T-}%{F$COLOR_DARK}bat %{F$COLOR_S2}${1:10}%{F-}"
} }
export -f bar_module_battery export -f bar_module_battery
bar_module_battery_updater() { bar_module_battery_updater() {
while true; do while true; do
echo -e "$MATCH_PREFIX""$(cat /sys/class/power_supply/BAT*/capacity)" > $BAR_FIFO # 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 sleep 60
done done
} }
export -f bar_module_battery_updater export -f bar_module_battery_updater
TYPE_RBM="$(type -t register_bar_module)" register_bar_module "$PRIORITY" "$MATCH" "bar_module_battery" "bar_module_battery_updater"
if [[ -n "$TYPE_RBM" ]] && [[ "$TYPE_RBM" = function ]]; then
register_bar_module "$PRIORITY" "$MATCH" "bar_module_battery" "bar_module_battery_updater"
fi

View file

@ -9,7 +9,8 @@ PID_PREFIX="bspwm"
MATCH_PREFIX="W" MATCH_PREFIX="W"
MATCH="$MATCH_PREFIX*" MATCH="$MATCH_PREFIX*"
DESKTOP_SPACER="" DESKTOP_SPACE_BEFORE=""
DESKTOP_SPACE_AFTER=""
SWITCH_DESKTOP_COMMAND="switch_desktop" SWITCH_DESKTOP_COMMAND="switch_desktop"
@ -32,22 +33,22 @@ bar_module_bspwm() {
bname=" %{A:$SWITCH_DESKTOP_COMMAND $cname:}${cname}%{A} " bname=" %{A:$SWITCH_DESKTOP_COMMAND $cname:}${cname}%{A} "
case $item in case $item in
O*) # focused occupied desktop O*) # focused occupied desktop
content="${content}%{B$COLOR_HIGHLIGHT}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACER" content="$DESKTOP_SPACE_BEFORE${content}%{B$COLOR_HIGHLIGHT}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACE_AFTER"
;; ;;
F*) # focused free desktop F*) # focused free desktop
content="${content}%{B$COLOR_DARK}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACER" content="$DESKTOP_SPACE_BEFORE${content}%{B$COLOR_DARK}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACE_AFTER"
;; ;;
U*) # urgent focused desktop U*) # urgent focused desktop
content="${content}%{B$COLOR_URGENT}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACER" content="$DESKTOP_SPACE_BEFORE${content}%{B$COLOR_URGENT}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACE_AFTER"
;; ;;
o*) # occupied unfocused desktop o*) # occupied unfocused desktop
content="${content}%{F$COLOR_FOREGROUND}${bname}%{F-}$DESKTOP_SPACER" content="$DESKTOP_SPACE_BEFORE${content}%{F$COLOR_FOREGROUND}${bname}%{F-}$DESKTOP_SPACE_AFTER"
;; ;;
f*) # free desktop f*) # free desktop
content="${content}%{F$COLOR_DARK}${bname}%{F-}$DESKTOP_SPACER" content="$DESKTOP_SPACE_BEFORE${content}%{F$COLOR_DARK}${bname}%{F-}$DESKTOP_SPACE_AFTER"
;; ;;
u*) # urgent desktop u*) # urgent desktop
content="${content}%{B$COLOR_URGENT}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACER" content="$DESKTOP_SPACE_BEFORE${content}%{B$COLOR_URGENT}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACE_AFTER"
;; ;;
esac esac
shift shift

View file

@ -7,7 +7,7 @@ export BAR_PATH="$DOTFILES_PATH/env/wm/extras/bar"
export BAR_PID_FILE="$BAR_PATH/wm_bar.pid" export BAR_PID_FILE="$BAR_PATH/wm_bar.pid"
# whether or not to start the bar when X starts # whether or not to start the bar when X starts
export BAR_ON_XINIT=0 export BAR_ON_XINIT=1
# the path to the bar's FIFO # the path to the bar's FIFO
export BAR_FIFO="$BAR_PATH/wm_bar_fifo.lock" export BAR_FIFO="$BAR_PATH/wm_bar_fifo.lock"