diff options
Diffstat (limited to 'tmux')
| -rwxr-xr-x | tmux/date.sh | 14 | ||||
| -rwxr-xr-x | tmux/vcs_info.sh | 58 | 
2 files changed, 31 insertions, 41 deletions
| diff --git a/tmux/date.sh b/tmux/date.sh index b3f6436..ca75a6d 100755 --- a/tmux/date.sh +++ b/tmux/date.sh @@ -1,11 +1,11 @@ -#!/usr/bin/env bash +#!/bin/sh  # source common.sh  SEPARATOR_LEFT_BOLD=""  SEPARATOR_LEFT_THIN=""  RESULT=$(date +"%a %D %H:%M") -#PROXY="proxychains4 -f /home/devi/proxies/ca/proxychains.conf" +PROXY="proxychains4 -q -f /home/devi/proxies/ice/proxychains.conf"  DAY="#[fg=colour255 bg=colour31]"$(echo "$RESULT" | gawk '{print $1}')  DATE="#[fg=colour255 bg=colour31]"$(echo "$RESULT" | gawk '{print $2}') @@ -16,20 +16,18 @@ JDATE="#[fg=colour255 bg=colour29]"$(jdate | gawk '{print $2" "$3}')  # 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=$(proxychains4 -f ~/proxies/ice/proxychains.conf curl 'wttr.in/tehran?T&format=%f') +WEATHER_INFO=$(${PROXY} curl -s 'wttr.in/tehran?T&format=%f')  if echo "${WEATHER_INFO}" | grep Unknown\ location; then    WEATHER="#[fg=colour255 bg=colour32]"no_temp  else    WEATHER="#[fg=colour255 bg=colour32]"${WEATHER_INFO}  fi -date >> /tmp/time_counter - -CPU_TEMP=$(sensors -j | jq .["\"coretemp-isa-0000\""]."\"Package id 0\"".temp1_input) -CPU_SECTION="#[fg=colour36 bg=colour24]${SEPARATOR_LEFT_BOLD}#[fg=colour16 bg=colour36]${CPU_TEMP} C" +CPU_TEMP=$(sensors -j 2>/dev/null | jq .["\"coretemp-isa-0000\""]."\"Package id 0\"".temp1_input) +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}') -if ! headsetcontrol -b ; then +if ! headsetcontrol -b >/dev/null 2>&1; then    HEADSET_BATTERY="not found"  else    HEADSET_BATTERY=$(headsetcontrol -b | grep Battery | awk '{print $2}') diff --git a/tmux/vcs_info.sh b/tmux/vcs_info.sh index 375ad5e..77773d6 100755 --- a/tmux/vcs_info.sh +++ b/tmux/vcs_info.sh @@ -1,6 +1,6 @@  #!/usr/bin/env bash -source common.sh +# source common.sh  SEPARATOR_RIGHT_BOLD=""  # SEPARATOR_RIGHT_THIN="" @@ -12,60 +12,52 @@ get_tmux_cwd() {    tmux display -p -F "#{pane_current_path}"  }  tmux_path=$(get_tmux_cwd) -cd "$tmux_path" -IFS='/' read -ra tmux_path_array <<< "$tmux_path" -pos=$(( ${#tmux_path_array[*]} - 1 )) -last=${tmux_path_array[$pos]} -for i in "${tmux_path_array[@]}" -do -  if [[ $i == "$last" ]]; then -    shortened_path+=$i -  else -    shortened_path+=${i:0:1}/ -  fi -done +# cd "$tmux_path" && IFS='/' read -ra tmux_path_array <<<"$tmux_path" +# pos=$((${#tmux_path_array[*]} - 1)) +# last=${tmux_path_array[$pos]} +# for i in "${tmux_path_array[@]}"; do +#   if [[ $i == "$last" ]]; then +#     shortened_path+=$i +#   else +#     shortened_path+=${i:0:1}/ +#   fi +# done  function gitadditions { -  git rev-parse --git-dir > /dev/null 2>&1 -  if [[ $? == 0 ]]; then +  if cd "${tmux_path}" && git rev-parse --git-dir >/dev/null 2>&1; then      insertions=$(git --no-pager diff --numstat | awk '{sum1+=$1}END{print sum1}') -    echo +$insertions +    echo +"$insertions"    fi  }  function gitdeletions { -  git rev-parse --git-dir > /dev/null 2>&1 -  if [[ $? == 0 ]]; then +  if cd "${tmux_path}" && git rev-parse --git-dir >/dev/null 2>&1; then      deletions=$(git --no-pager diff --numstat | awk '{sum2+=$2}END{print sum2}') -    echo -$deletions +    echo -"$deletions"    fi  }  function git_untracked_info { -  git rev-parse --git-dir > /dev/null 2>&1 -  if [[ $? == 0 ]]; then +  if cd "${tmux_path}" && git rev-parse --git-dir >/dev/null 2>&1; then      untracked=$(git ls-files --others --exclude-standard | wc -w) -    echo ⋯$untracked +    echo ⋯"$untracked"    fi  }  function git_branch_info { -  git rev-parse --git-dir > /dev/null 2>&1 -  if [[ $? == 0 ]]; then +  if cd "${tmux_path}" && git rev-parse --git-dir >/dev/null 2>&1; then      branch=$(git rev-parse --abbrev-ref HEAD) -    echo " "$branch +    echo " $branch"    fi  }  function repo_info { -  git rev-parse --git-dir > /dev/null 2>&1 -  if [[ $? == 0 ]]; then +  if cd "${tmux_path}" && git rev-parse --git-dir >/dev/null 2>&1; then      insertions=$(git --no-pager diff --numstat | awk '{sum1+=$1}END{print sum1}') -    git remote -v | grep github > /dev/null 2>&1 -    if [[ $? == 0 ]]; then +    if git remote -v | grep github >/dev/null 2>&1; then        echo        else -      echo   +      echo       fi    else      : @@ -73,9 +65,9 @@ function repo_info {  }  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") +  eth_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price") +  cake_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price") +  monero_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price")    echo "${eth_price}/${cake_price}/${monero_price}"  } | 
