fix stupid oversight
This commit is contained in:
parent
53e50aae2f
commit
386f0b6610
|
@ -30,7 +30,6 @@ SEPARATOR="❰" # Separator to use. Alternative separators: "❰", "<", "|"
|
||||||
COLORFG=true # Color foreground (true/false)
|
COLORFG=true # Color foreground (true/false)
|
||||||
COLORBG=false # Color background (true/false)
|
COLORBG=false # Color background (true/false)
|
||||||
CLICKABLE=true # Enable clickability (Requires dwm with statuscmd or speedwm) (true/false)
|
CLICKABLE=true # Enable clickability (Requires dwm with statuscmd or speedwm) (true/false)
|
||||||
CHARLIMIT=auto # Limit characters to CHARLIMIT. Enter false to not have a limit. Enter auto to use xdpyinfo. (num/auto/false)
|
|
||||||
ITEM_ORDER="@2@3@11@4@1@6@8@5@9@7@10" # Item order. @1 means item 1, @6 means item 6 and so on. (text)
|
ITEM_ORDER="@2@3@11@4@1@6@8@5@9@7@10" # Item order. @1 means item 1, @6 means item 6 and so on. (text)
|
||||||
|
|
||||||
# Status bar modules
|
# Status bar modules
|
||||||
|
@ -313,77 +312,77 @@ ptext() {
|
||||||
# Output of commands
|
# Output of commands
|
||||||
# We're doing this so we can manipulate them easily for various reasons.
|
# We're doing this so we can manipulate them easily for various reasons.
|
||||||
if [ "$ENABLE_ITEM1" = "true" ]; then
|
if [ "$ENABLE_ITEM1" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_ram)" != "" ]; then
|
if [ "$(ITEM1)" != "" ]; then
|
||||||
itemcmd1="$(echo "$(ITEM1)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd1="$(echo "$(ITEM1)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd1="$FSETCOLORCMD7$BSETCOLORCMD7 $itemcmd1"
|
itemcmd1="$FSETCOLORCMD7$BSETCOLORCMD7 $itemcmd1"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENABLE_ITEM2" = "true" ]; then
|
if [ "$ENABLE_ITEM2" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_time)" != "" ]; then
|
if [ "$(ITEM2)" != "" ]; then
|
||||||
itemcmd2="$(echo "$(ITEM2)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd2="$(echo "$(ITEM2)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd2="$FSETCOLORCMD11$BSETCOLORCMD11 $itemcmd2"
|
itemcmd2="$FSETCOLORCMD11$BSETCOLORCMD11 $itemcmd2"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENABLE_ITEM3" = "true" ]; then
|
if [ "$ENABLE_ITEM3" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_date)" != "" ]; then
|
if [ "$(ITEM3)" != "" ]; then
|
||||||
itemcmd3="$(echo "$(ITEM3)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd3="$(echo "$(ITEM3)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd3="$FSETCOLORCMD10$BSETCOLORCMD10 $itemcmd3"
|
itemcmd3="$FSETCOLORCMD10$BSETCOLORCMD10 $itemcmd3"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENABLE_ITEM4" = "true" ]; then
|
if [ "$ENABLE_ITEM4" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_vol)" != "" ]; then
|
if [ "$(ITEM4)" != "" ]; then
|
||||||
itemcmd4="$(echo "$(ITEM4)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd4="$(echo "$(ITEM4)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd4="$FSETCOLORCMD8$BSETCOLORCMD8 $itemcmd4"
|
itemcmd4="$FSETCOLORCMD8$BSETCOLORCMD8 $itemcmd4"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENABLE_ITEM5" = "true" ]; then
|
if [ "$ENABLE_ITEM5" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_weather)" != "" ]; then
|
if [ "$(ITEM5)" != "" ]; then
|
||||||
itemcmd5="$(echo "$(ITEM5)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd5="$(echo "$(ITEM5)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd5="$FSETCOLORCMD3$BSETCOLORCMD3 $itemcmd5"
|
itemcmd5="$FSETCOLORCMD3$BSETCOLORCMD3 $itemcmd5"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENABLE_ITEM6" = "true" ]; then
|
if [ "$ENABLE_ITEM6" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_net)" != "" ]; then
|
if [ "$(ITEM6)" != "" ]; then
|
||||||
itemcmd6="$(echo "$(ITEM6)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd6="$(echo "$(ITEM6)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd6="$FSETCOLORCMD6$BSETCOLORCMD6 $itemcmd6"
|
itemcmd6="$FSETCOLORCMD6$BSETCOLORCMD6 $itemcmd6"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENABLE_ITEM7" = "true" ]; then
|
if [ "$ENABLE_ITEM7" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_dfmpeg)" != "" ]; then
|
if [ "$(ITEM7)" != "" ]; then
|
||||||
itemcmd7="$(echo "$(ITEM7)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd7="$(echo "$(ITEM7)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd7="$FSETCOLORCMD5$BSETCOLORCMD5 $itemcmd7"
|
itemcmd7="$FSETCOLORCMD5$BSETCOLORCMD5 $itemcmd7"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENABLE_ITEM8" = "true" ]; then
|
if [ "$ENABLE_ITEM8" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_temp)" != "" ]; then
|
if [ "$(ITEM8)" != "" ]; then
|
||||||
itemcmd8="$(echo "$(ITEM8)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd8="$(echo "$(ITEM8)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd8="$FSETCOLORCMD4$BSETCOLORCMD4 $itemcmd8"
|
itemcmd8="$FSETCOLORCMD4$BSETCOLORCMD4 $itemcmd8"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENABLE_ITEM9" = "true" ]; then
|
if [ "$ENABLE_ITEM9" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_music)" != "" ]; then
|
if [ "$(ITEM9)" != "" ]; then
|
||||||
itemcmd9="$(echo "$(ITEM9)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd9="$(echo "$(ITEM9)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd9="$FSETCOLORCMD2$BSETCOLORCMD2 $itemcmd9"
|
itemcmd9="$FSETCOLORCMD2$BSETCOLORCMD2 $itemcmd9"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENABLE_ITEM10" = "true" ]; then
|
if [ "$ENABLE_ITEM10" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_news)" != "" ]; then
|
if [ "$(ITEM10)" != "" ]; then
|
||||||
itemcmd10="$(echo "$(ITEM10)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd10="$(echo "$(ITEM10)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd10="$FSETCOLORCMD9$BSETCOLORCMD9 $itemcmd10"
|
itemcmd10="$FSETCOLORCMD9$BSETCOLORCMD9 $itemcmd10"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENABLE_ITEM11" = "true" ]; then
|
if [ "$ENABLE_ITEM11" = "true" ]; then
|
||||||
if [ "$(cat /tmp/module_bat)" != "" ]; then
|
if [ "$(ITEM11)" != "" ]; then
|
||||||
itemcmd11="$(echo "$(ITEM11)" | sed ':a;N;$!ba;s/\n//g')"
|
itemcmd11="$(echo "$(ITEM11)" | sed ':a;N;$!ba;s/\n//g')"
|
||||||
itemcmd11="$FSETCOLORCMD8$BSETCOLORCMD8 $itemcmd11"
|
itemcmd11="$FSETCOLORCMD8$BSETCOLORCMD8 $itemcmd11"
|
||||||
fi
|
fi
|
||||||
|
@ -396,83 +395,6 @@ ptext() {
|
||||||
ITEMS_TEXT="$(echo "$ITEM_ORDER" | sed "s/^[[:space:]]*//g; s|@10|$itemcmd10|; s|@11|$itemcmd11|; s|@1|$itemcmd1|; s|@2|$itemcmd2|; s|@3|$itemcmd3|; s|@4|$itemcmd4|; s|@5|$itemcmd5|; s|@6|$itemcmd6|; s|@7|$itemcmd7|; s|@8|$itemcmd8|; s|@9|$itemcmd9|; s|%|%%|g")"
|
ITEMS_TEXT="$(echo "$ITEM_ORDER" | sed "s/^[[:space:]]*//g; s|@10|$itemcmd10|; s|@11|$itemcmd11|; s|@1|$itemcmd1|; s|@2|$itemcmd2|; s|@3|$itemcmd3|; s|@4|$itemcmd4|; s|@5|$itemcmd5|; s|@6|$itemcmd6|; s|@7|$itemcmd7|; s|@8|$itemcmd8|; s|@9|$itemcmd9|; s|%|%%|g")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Auto-get character limit based on screen resolution
|
|
||||||
# This is pretty hacky, but it works as a default.
|
|
||||||
# Setting this to "false" is recommended if you've got a big monitor
|
|
||||||
# I think the first three numbers of your screen resolution times 1.5 is a good max.
|
|
||||||
# I've got a 1366x768 12 inch ThinkPad so I decided to implement this.
|
|
||||||
# If anyone has a better method, please PR.
|
|
||||||
if [ "$CHARLIMIT" = "auto" ]; then
|
|
||||||
command -v xdpyinfo > /dev/null && \
|
|
||||||
RES="$(xdpyinfo | awk '/dimensions/ {print $2}' | sed 's/.x....*//g; s/[^0-9]*//g')"
|
|
||||||
CHARS="$(expr "$RES" "*" "1")"
|
|
||||||
|
|
||||||
if [ "$CHARS" = "" ]; then
|
|
||||||
CHARS=false
|
|
||||||
fi
|
|
||||||
elif [ "$CHARLIMIT" != "false" ]; then
|
|
||||||
CHARS=$CHARLIMIT
|
|
||||||
else
|
|
||||||
CHARS=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$CHARS" != "false" ]; then
|
|
||||||
# Truncate item 11
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd11=""
|
|
||||||
|
|
||||||
# Truncate item 10
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd10=""
|
|
||||||
|
|
||||||
# Truncate item 9
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd9=""
|
|
||||||
|
|
||||||
# Truncate item 8
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd8=""
|
|
||||||
|
|
||||||
# Truncate item 7
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd7=""
|
|
||||||
|
|
||||||
# Truncate item 6
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd6=""
|
|
||||||
|
|
||||||
# Truncate item 5
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd5=""
|
|
||||||
|
|
||||||
# Truncate item 4
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd4=""
|
|
||||||
|
|
||||||
# Truncate item 3
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd3=""
|
|
||||||
|
|
||||||
# Truncate item 2
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd2=""
|
|
||||||
|
|
||||||
# Truncate item 1
|
|
||||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
|
||||||
itemcmd1=""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
print
|
print
|
||||||
pgrep -x speedwm > /dev/null || exit 1
|
pgrep -x speedwm > /dev/null || exit 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue