aboutsummaryrefslogblamecommitdiffstats
path: root/tmux/date.sh
blob: 4c26bbcde10eca0da38efe56347fa9fea53a3691 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                                     

                                                                   

                                                                      

                                                                                                                                        
                                                              
 
                                                                                                                                                                                                                                                                                   
#!/usr/bin/env bash

# source common.sh
SEPARATOR_LEFT_BOLD=""
SEPARATOR_LEFT_THIN=""

RESULT=$(date +"%a %D %H:%M")

DAY="#[fg=colour255 bg=colour31]"$(echo $RESULT | gawk '{print $1}')
DATE="#[fg=colour255 bg=colour31]"$(echo $RESULT | gawk '{print $2}')
TIME="#[fg=colour255 bg=colour31]"$(echo $RESULT | gawk '{print $3}')
UTC_TIME_RESULT=$(date -u +"%H:%M")
UTC_TIME="#[fg=colour255 bg=colour25]"$(echo GMT: $UTC_TIME_RESULT)
# JDATE="#[fg=colour255 bg=colour29]"$(jdate | gawk '{print $2" "$3}')
JDATE="#[fg=colour255 bg=colour29]"$(jdate | gawk '{print $2" "$3}')
OPENWEATHERMAP_TOKEN=$(cat /home/devi/scripts/tmux/openweathermap.json|jq -r ".token")
WEATHER_INFO=$(curl "https://api.openweathermap.org/data/2.5/weather?q=Tehran&appid=$OPENWEATHERMAP_TOKEN&units=metric"|jq ".main.temp")
WEATHER="#[fg=colour255 bg=colour32]"$(echo $WEATHER_INFO" C")

echo "#[fg=colour32 bg=colour16]$SEPARATOR_LEFT_BOLD$WEATHER#[fg=colour29 bg=colour32]$SEPARATOR_LEFT_BOLD$JDATE #[fg=colour31 bg=colour29]$SEPARATOR_LEFT_BOLD$DAY $SEPARATOR_LEFT_THIN $DATE $SEPARATOR_LEFT_THIN $TIME #[fg=colour25 bg=colour31]$SEPARATOR_LEFT_BOLD$UTC_TIME "