diff options
Diffstat (limited to 'tmux')
-rwxr-xr-x | tmux/date.sh | 37 | ||||
-rwxr-xr-x | tmux/vcs_info.sh | 15 |
2 files changed, 35 insertions, 17 deletions
diff --git a/tmux/date.sh b/tmux/date.sh index f72cad0..1bfbc01 100755 --- a/tmux/date.sh +++ b/tmux/date.sh @@ -11,24 +11,33 @@ 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]"$UTC_TIME_RESULT +UTC_TIME="#[fg=colour255 bg=colour25]"${UTC_TIME_RESULT} JDATE="#[fg=colour255 bg=colour29]"$(jdate | gawk '{print $2" "$3}') -# OPENWEATHERMAP_TOKEN=$(cat /home/devi/scripts/tmux/openweathermap.json|jq -r ".token") -# WEATHER_INFO=$(sleep 120 && torsocks curl "https://api.openweathermap.org/data/2.5/weather?q=Tehran&appid=$OPENWEATHERMAP_TOKEN&units=metric"|jq ".main.temp") + +# OPENWEATHERMAP_TOKEN=$(jq -r ".token" < /home/devi/scripts/tmux/openweathermap.json) +# WEATHER_INFO=$(sleep 120 && proxychains4 -q -f /home/devi/proxies/ice/proxychains.conf curl "https://api.openweathermap.org/data/2.5/weather?q=Tehran&appid=${OPENWEATHERMAP_TOKEN}&units=metric"|jq ".main.temp") WEATHER_INFO=$(curl 'wttr.in/tehran?T&format=%f') -echo "$WEATHER_INFO" | grep Unknown\ location; -if [ ! $? ]; then - WEATHER="#[fg=colour255 bg=colour32]"err +if echo "${WEATHER_INFO}" | grep Unknown\ location; then + WEATHER="#[fg=colour255 bg=colour32]"no_temp else - WEATHER="#[fg=colour255 bg=colour32]"$WEATHER_INFO + WEATHER="#[fg=colour255 bg=colour32]"${WEATHER_INFO} fi + CPU_TEMP=$(sensors -j | jq .["\"coretemp-isa-0000\""]."\"Package id 0\"".temp1_input) -CPU_SECTION="#[fg=colour36 bg=colour16]$SEPARATOR_LEFT_BOLD#[fg=colour16 bg=colour36]$CPU_TEMP C" +CPU_SECTION="#[fg=colour36 bg=colour24]${SEPARATOR_LEFT_BOLD}#[fg=colour16 bg=colour36]${CPU_TEMP} C" BATTERY=$(upower -i "$(upower -e | grep 'BAT')" | grep -E "percentage" | awk '{print $2}') -echo "$CPU_SECTION#[fg=colour32 bg=colour36]\ -$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=colour214 bg=colour31]\ -$SEPARATOR_LEFT_BOLD#[fg=colour0 bg=colour214]$BATTERY #[fg=colour25 bg=colour214]\ -$SEPARATOR_LEFT_BOLD$UTC_TIME " +if ! headsetcontrol -b ; then + HEADSET_BATTERY="not found" +else + HEADSET_BATTERY=$(headsetcontrol -b | grep Battery | awk '{print $2}') +fi + +echo "#[bg=colour0 fg=colour24]\ +${SEPARATOR_LEFT_BOLD}#[fg=colour0 bg=colour24]${HEADSET_BATTERY}\ +${CPU_SECTION}#[fg=colour32 bg=colour36]\ +${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=colour214 bg=colour31]\ +${SEPARATOR_LEFT_BOLD}#[fg=colour0 bg=colour214]${BATTERY} #[fg=colour25 bg=colour214]\ +${SEPARATOR_LEFT_BOLD}${UTC_TIME} " diff --git a/tmux/vcs_info.sh b/tmux/vcs_info.sh index f6405a3..2215f7f 100755 --- a/tmux/vcs_info.sh +++ b/tmux/vcs_info.sh @@ -72,14 +72,23 @@ function repo_info { fi } +function get_eth_price { + eth_price=$(proxychains4 -q -f ~/proxies/swe/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/price?name=ETH&unit=USD" | jq ".price") + cake_price=$(proxychains4 -q -f ~/proxies/swe/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/price?name=CAKE&unit=USD" | jq ".price") + monero_price=$(proxychains4 -q -f ~/proxies/swe/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/price?name=XMR&unit=USD" | jq ".price") + echo "${eth_price}/${cake_price}/${monero_price}" +} + tmux_session_info=" #S:#I.#P" branch_info="#[fg=colour16]$(repo_info)#[fg=colour0 bg=colour39]"$(git_branch_info) untracked_info="#[fg=colour255 bg=colour244]"$(git_untracked_info) deletions_info="#[fg=colour255 bg=colour1]"$(gitdeletions) -additions__info="#[fg=colour255 bg=colour22]"$(gitadditions) +additions_info="#[fg=colour255 bg=colour22]"$(gitadditions) +eth_price="#[fg=colour16 bg=colour37]"$(get_eth_price) echo "#[fg=colour255 bg=colour26]$tmux_session_info #[fg=colour26 bg=colour39]$SEPARATOR_RIGHT_BOLD \ $branch_info #[fg=colour39 bg=colour22]$SEPARATOR_RIGHT_BOLD \ -$additions__info #[fg=colour22 bg=colour1]$SEPARATOR_RIGHT_BOLD \ +$additions_info #[fg=colour22 bg=colour1]$SEPARATOR_RIGHT_BOLD \ $deletions_info #[fg=colour1 bg=colour244]$SEPARATOR_RIGHT_BOLD \ -$untracked_info #[fg=colour244 bg=colour16]$SEPARATOR_RIGHT_BOLD" +$untracked_info #[fg=colour244 bg=colour37]$SEPARATOR_RIGHT_BOLD \ +$eth_price #[fg=colour37 bg=colour16]$SEPARATOR_RIGHT_BOLD" |