/
lolclock
executable file
·60 lines (56 loc) · 2.04 KB
/
lolclock
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
function showtime()
{
for font in $fontpath/*
do
tput clear
now=$(date +"%I:%M %P") # show HH:MM: PP
second=$(date +"%S")
toilet $now --font "$(echo $font | cut -d "/" -f 5 | cut -d "." -f 1)" | lolcat
sleep $((60-$second))
#echo $font
#sleep 1
done
showtime
}
# check figlet font file
fontpath=/usr/share/figlet
font=$fontpath/Varsity.flf
if [[ ! -f $font ]]; then
cd $fontpath
echo Installing font file to $fontpath
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/Varsity.flf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/Train.flf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/swampland.flf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/starwars.flf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/smbraille.tlf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/Slant.flf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/Rounded.flf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/rev.flf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/Rammstein.flf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/pagga.tlf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/Bolger.flf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/Big Money-nw.flf
sudo wget https://raw.githubusercontent.com/xero/figlet-fonts/master/ANSI Shadow.flf
fi
function help()
{
echo ""
echo "lolclock usage: "
echo " -h --help : Check this help message."
echo " -g --gnome-terminal : Open new gnome terminal window with lolclock."
echo ""
exit 1
}
case $1 in
-g|--gnome-terminal)
gnome-terminal --title="lolclock" --geometry 55x10 -- bash -c "$(declare -f showtime); showtime; bash" &
;;
-h|--help)
help
;;
*)
tput clear
showtime
;;
esac