rwxrob-dot/scripts/marquee
Rob Muhlestein 2ea0289e9f Rebase
2022-02-09 02:29:05 -05:00

51 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/bash
declare clear=$'\034[2J'
declare top=$'\033[H'
repeat() {
for ((i=0;i<$2;i++)); do echo -n "$1"; done
}
marquee() {
local topic time right cols pomo
local -i topicremain timeremain timew topicw
local -a timebar topicbar
#topic="$(topic)" topic="${topic#* }"
topic="$(head -1 ~/.currently)"
#pomo="$(pomo)" pomo=${pomo%%m*} pomo=${pomo%%s*}
#mode="$(iam mode emoji)"
zet="zet:$(zet current)"
time="$(date +"%A, %B %-e, %Y, %-H:%M %Z%0z")"
replay=$(printf "(%02d)" "$((20-$(date +"%S")%20))")
tilboost="$(countdown 11:11:11 May 4)"
[[ -n "$pomo" ]] && timebar+=("$pomo")
[[ -n "$pomo" ]] && topicbar+=("$pomo")
[[ -n "$time" ]] && timebar+=("$time")
[[ -n "$topic" ]] && topicbar+=("$topic")
timebarb="${timebar[*]}"
topicbarb="${topicbar[*]}"
topicremain=$(( $(tput cols) - ${#topicbarb} ))
timeremain=$(( $(tput cols) - ${#timebarb} ))
topicspace=$(( topicremain - ${#mode} - ${#zet}))
timespace=$(( timeremain - ${#mode} - ${#zet} - ${#tilboost} - 5))
#if (( $(date +%s)%20 < 10 ));then
#echo "$topicbarb $(repeat $' ' "$topicspace") rwxrob.tv"
#else
#echo "$mode $timebarb $(repeat $' ' "$timespace") rwxrob.tv $zet"
echo "$timebarb $replay [boost in $tilboost] $(repeat $' ' "$timespace") rwxrob.tv"
#fi
}
marquee "$@"
# if [[ -t 1 ]];then
# trap "setterm --cursor on; echo $clear; exit; trap -- - SIGINT SIGTERM" SIGTERM SIGINT
# setterm --cursor off
# while true; do
# echo -n "$clear$top"
# marquee "$@"
# sleep 1
# done
# fi