use epoc time based welcome screen

This commit is contained in:
Daylin Morgan 2022-09-09 10:28:23 -05:00
parent 20c7b6e823
commit 6851fe185d
2 changed files with 31 additions and 1 deletions

30
bin/print-epoch Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
COLUMNS=$(tput cols)
digit() {
echo -en "\U1FBF$1 "
}
print-time() {
TIMESTAMP="$1"
for (( i=0; i<${#TIMESTAMP}; i++ )); do
digit "${TIMESTAMP:$i:1}"
done
}
spacing() {
for (( i=0; i<$1; i++ )); do
printf "%s" "-"
done
}
epoch=$(print-time "$(date +'%s')")
side=$(spacing $(((COLUMNS-(${#epoch}+6))/2)))
printf "\n\033[1m%s [ \033[1;9%dm%s\033[39m ] %s\033[0m\n" \
"$side" \
"$((RANDOM % 7+1))" \
"$epoch" \
"$side"

View file

@ -34,5 +34,5 @@ unset EXTRAFILE
export DOTFILES_DIR DOTFILES_EXTRA_DIR
# welcome art
! is-tty && $DOTFILES_DIR/bin/gradient
! is-tty && $DOTFILES_DIR/bin/print-epoch