fix reverse color mode and break after the interesting output has been printed
This commit is contained in:
parent
3495061f3f
commit
647ec8656f
@ -32,6 +32,14 @@ else
|
||||
[[ -f "$COLORS" ]] && COLORS=true || COLORS=false
|
||||
fi
|
||||
|
||||
# variables to define
|
||||
# LOAD -- The percentage of something provided like LOAD=67 which meas 76%
|
||||
# LONG_TEXT -- Text to display in case LONG=True
|
||||
# SHORT_TEXT -- Text to display in case LONG=True and the i3 status bar
|
||||
# runs out of space
|
||||
# REVERSE_COLOR -- Set this to True if the colors should be selected in
|
||||
# reverse orer for a given load
|
||||
#
|
||||
# get $LOAD, $LOAD_REVERSE, $LONG_TEXT and $SHORT_TEXT
|
||||
source $HOME/.config/i3blocks/modules/${1}.sh
|
||||
|
||||
@ -52,18 +60,19 @@ else
|
||||
done
|
||||
fi
|
||||
|
||||
# print colors or black/white
|
||||
# print font color
|
||||
if [[ "$LOAD" = false ]]; then
|
||||
echo "${BW[4]}"
|
||||
else
|
||||
for i in "${!BW[@]}"; do
|
||||
if [[ $LOAD -lt $((($i+1) * $INTERVAL)) ]]; then
|
||||
if [[ "$REVERSE_COLOR" = true ]]; then
|
||||
u=$((${#BW[@]}-$i))
|
||||
u=$((${#BW[@]}-$i-1))
|
||||
[[ "$COLORS" = true ]] && echo "${COLOR[$u]}" || echo "${BW[$u]}"
|
||||
else
|
||||
[[ "$COLORS" = true ]] && echo "${COLOR[$i]}" || echo "${BW[$i]}"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
@ -7,7 +7,6 @@ else
|
||||
IF=$(ip route | awk '/^default/ { print $5 ; exit }')
|
||||
fi
|
||||
|
||||
# check if network interface exists or is empty
|
||||
if [[ -z "$IF" || ! -d "/sys/class/net/$IF" ]]; then
|
||||
printf "$IF not found\nn/a\n"
|
||||
exit 33
|
||||
|
Reference in New Issue
Block a user