Skip to content

Instantly share code, notes, and snippets.

@Blokyk
Last active April 21, 2022 14:41
Show Gist options
  • Save Blokyk/e5c2f162d2dfc14b7b2abc4a4e172189 to your computer and use it in GitHub Desktop.
Save Blokyk/e5c2f162d2dfc14b7b2abc4a4e172189 to your computer and use it in GitHub Desktop.
display_clock
#!/bin/bash
function center_txt() {
txt=$1
line_nb=$(wc -l <<< $txt)
available_lines=$(($(($LINES - $line_nb)) / 2))
#echo $available_lines
#echo "$txt"
perl -E "say \"\n\" x $available_lines"
#echo $top | wc -l
echo "$txt"
perl -E "say \"\n\" x $available_lines"
}
export -f center_txt
if [[ "X$1" = "X" ]]; then
export FONT="ANSI Shadow"
else
FONT="$1"
fi
export FONT
function prnt() {
center_txt "$(date "+%H : %M : %S" | figlet -ctf "$FONT" && date "+%a. %d %b %Y" | figlet -ctf Small)"
}
export -f prnt
watch -n 1 -x bash -c prnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment