dotfiles/.local/bin/dwmbar

57 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
DD=";"
DELIM=" "
DELIM_START=0
mkdir -p ~/.local/tmp/
run() {
for FILE in $(ls ~/.local/scripts)
do
touch "$HOME/.local/tmp/.tmp_$(echo $FILE | cut -d'_' -f3)_BIT"
{
while true
do
echo "$(sh ~/.local/scripts/$FILE)" > "$HOME/.local/tmp/.tmp_$(echo $FILE | cut -d'_' -f3)_BIT"
sleep=$(echo $FILE | cut -d'_' -f2)
if [ $sleep -eq 0 ]
then
sleep=0.1
fi
sleep $sleep
done
} &
done
}
status() {
strt=0
[ $DELIM_START -eq 1 ] && strt=1
for FILE in $(ls ~/.local/scripts)
do
res=$(cat "$HOME/.local/tmp/.tmp_$(echo $FILE | cut -d'_' -f3)_BIT")
if [ $strt -eq 0 ]
then
strt=1
echo "$res"
else
echo "$DELIM$res"
fi
done
}
run
while :
do
stat=$(status | tr -d '\n')
extrabarleft="^b#440044^Status^d^ ^c#ff0000^bar 2^d^"
extrabarright="^b#444400^Right ^b#00ff00^text^d^ ^c#ff0000^pisec ^b#000044^dlinee3bu^d^"
xprop -root -set WM_NAME "$stat$DD$extrabarleft$DD$extrabarright"
sleep 0.1
done