Created
February 5, 2021 22:57
-
-
Save erkiesken/603b05912da3ae4960a4058777368c06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# <bitbar.title>UTC and local timezone</bitbar.title> | |
# <bitbar.version>v1.0.0</bitbar.version> | |
# <bitbar.author>Erki Esken</bitbar.author> | |
# <bitbar.author.github>erkiesken</bitbar.author.github> | |
# <bitbar.desc>Show the current time in local and UTC timezone.</bitbar.desc> | |
TIME_UTC=$(TZ="UTC" date "+%H:%M") | |
TIME_LOCAL=$(date "+%H:%M") | |
TIME_EPOCH=$(date "+%s") | |
TIME_DATE=$(date "+%A, %m/%d") | |
TIME_DATE_ISO=$(TZ="UTC" date "+%Y-%m-%dT%H:%M:00Z") | |
TIME_DATE_MONTH=$(date "+%m") | |
TIME_DATE_DAY=$(date "+%d") | |
nice_numbers() { | |
local s=$1 | |
s="${s//0/πΆ}" | |
s="${s//1/π·}" | |
s="${s//2/πΈ}" | |
s="${s//3/πΉ}" | |
s="${s//4/πΊ}" | |
s="${s//5/π»}" | |
s="${s//6/πΌ}" | |
s="${s//7/π½}" | |
s="${s//8/πΎ}" | |
s="${s//9/πΏ}" | |
echo "${s}" | |
} | |
superscript_numbers() { | |
local s=$1 | |
s="${s//0/β°}" | |
s="${s//1/ΒΉ}" | |
s="${s//2/Β²}" | |
s="${s//3/Β³}" | |
s="${s//4/β΄}" | |
s="${s//5/β΅}" | |
s="${s//6/βΆ}" | |
s="${s//7/β·}" | |
s="${s//8/βΈ}" | |
s="${s//9/βΉ}" | |
echo "${s}" | |
} | |
subscript_numbers() { | |
local s=$1 | |
s="${s//0/β}" | |
s="${s//1/β}" | |
s="${s//2/β}" | |
s="${s//3/β}" | |
s="${s//4/β}" | |
s="${s//5/β }" | |
s="${s//6/β}" | |
s="${s//7/β}" | |
s="${s//8/β}" | |
s="${s//9/β}" | |
echo "${s}" | |
} | |
SHORT_DATE="$(superscript_numbers "${TIME_DATE_MONTH}")β$(subscript_numbers "${TIME_DATE_DAY}")" | |
nice_numbers "${SHORT_DATE} π β${TIME_LOCAL} π €β${TIME_UTC}" | |
echo "---" | |
echo "${TIME_DATE} | color=#999999" | |
echo "Unix: ${TIME_EPOCH} | color=#999999 bash='~/Tools/pbcopy.sh' param1='${TIME_EPOCH}' terminal=false refresh=false" | |
echo "${TIME_DATE_ISO}| color=#999999 bash='~/Tools/pbcopy.sh' param1='${TIME_DATE_ISO}' terminal=false refresh=false" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment