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_RBM2="$(type -t ${MODULE_INIT[$3]})"
echo "-----> - $TYPE_RBM - $TYPE_RBM2 -" >> "$BAR_LOG"
# echo "-----> - $TYPE_RBM - $TYPE_RBM2 -" >> "$BAR_LOG"
${MODULE_INIT[$1]} &
PID=$!
echo $PID > "$BAR_PATH/modules/$3.pid"
@ -41,7 +41,7 @@ register_bar_module() {
export -f register_bar_module
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
f=""
fi
@ -53,7 +53,7 @@ for f in "$BAR_PATH/modules/"*-bm.bash; do
done
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
# echo ${!MODULE_MATCH[@]} >> $BAR_LOG
if [[ $line == ${MODULE_MATCH[$i]} ]]; then

View file

@ -3,25 +3,23 @@
source "$DOTFILES_PATH/variables.bash"
source "$BAR_PATH/colors.bash"
PRIORITY=31000
PRIORITY=22000
MATCH_PREFIX="BM_BATTERY"
MATCH="$MATCH_PREFIX*"
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
bar_module_battery_updater() {
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
done
}
export -f bar_module_battery_updater
TYPE_RBM="$(type -t register_bar_module)"
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="$MATCH_PREFIX*"
DESKTOP_SPACER=""
DESKTOP_SPACE_BEFORE=""
DESKTOP_SPACE_AFTER=""
SWITCH_DESKTOP_COMMAND="switch_desktop"
@ -32,22 +33,22 @@ bar_module_bspwm() {
bname=" %{A:$SWITCH_DESKTOP_COMMAND $cname:}${cname}%{A} "
case $item in
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
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
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
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
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
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
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"
# 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
export BAR_FIFO="$BAR_PATH/wm_bar_fifo.lock"