TheRepoClub-DotFiles/repobar/.local/bin/repobar/bar_clock
The-Repo-Club e265d25e6a
Update DotFiles
Signed-off-by: The-Repo-Club <wayne6324@gmail.com>
2022-07-14 17:15:51 +01:00

59 lines
981 B
Bash
Executable File

#!/usr/bin/env bash
DaySuffix() {
if [ "x$(date +%-d | cut -c2)x" = "xx" ]; then
DayNum=$(date +%-d)
else
DayNum=$(date +%-d | cut -c2)
fi
CheckSpecialCase=$(date +%-d)
case $DayNum in
0)
echo "th"
;;
1)
if [ "$CheckSpecialCase" = "11" ]; then
echo "th"
else
echo "st"
fi
;;
2)
if [ "$CheckSpecialCase" = "12" ]; then
echo "th"
else
echo "nd"
fi
;;
3)
if [ "$CheckSpecialCase" = "13" ]; then
echo "th"
else
echo "rd"
fi
;;
[4-9])
echo "th"
;;
*)
return 1
;;
esac
}
clock() {
# load colors
. ~/.config/repobar/bar_themes/minimal-mistakes
icon_date="  "
icon_time=" "
date=$(date +" %-d$(DaySuffix) %b %Y")
time=$(date +" %I:%M %P")
printf " %s %s %s %s \n" "^c$Foreground^^b$Green^$icon_date" "^c$Foreground^^b$Green_Bright^ $date" "^c$Foreground^^b$Green^$icon_time" "^c$Foreground^^b$Green_Bright^ $time"
}
clock