diff options
author | terminaldweller <thabogre@gmail.com> | 2021-08-05 05:14:10 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2021-08-05 05:14:10 +0000 |
commit | 5f596a3f401a0a40eefcc0f8b6c6b5083748cc1a (patch) | |
tree | a892e31077574f1c1a340af257bb6e27ae0ad89c /tmux | |
parent | update for neomutt (diff) | |
download | scripts-5f596a3f401a0a40eefcc0f8b6c6b5083748cc1a.tar.gz scripts-5f596a3f401a0a40eefcc0f8b6c6b5083748cc1a.zip |
a lot of updates and fixes
Diffstat (limited to 'tmux')
-rwxr-xr-x | tmux/date.sh | 7 | ||||
-rwxr-xr-x | tmux/vcs_info.sh | 20 |
2 files changed, 20 insertions, 7 deletions
diff --git a/tmux/date.sh b/tmux/date.sh index 1c08e47..c0f1bcf 100755 --- a/tmux/date.sh +++ b/tmux/date.sh @@ -9,8 +9,11 @@ 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="#[fg=colour255 bg=colour75]"$(date -u +"%H:%I") +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}') +WEATHER_INFO=$(curl "https://api.openweathermap.org/data/2.5/weather?q=Tehran&appid=a2fab6f29fbe16083cf382306c2abee4&units=metric"|jq ".main.temp") +WEATHER="#[fg=colour255 bg=colour32]"$(echo $WEATHER_INFO" C") -echo "#[fg=colour29 bg=colour16]$SEPARATOR_LEFT_BOLD$JDATE #[fg=colour31 bg=colour29]$SEPARATOR_LEFT_BOLD$DAY $SEPARATOR_LEFT_THIN $DATE $SEPARATOR_LEFT_THIN $TIME #[fg=colour75 bg=colour31]$SEPARATOR_LEFT_BOLD$UTC_TIME " +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 " diff --git a/tmux/vcs_info.sh b/tmux/vcs_info.sh index 1369b3d..2b2d857 100755 --- a/tmux/vcs_info.sh +++ b/tmux/vcs_info.sh @@ -29,7 +29,7 @@ function gitadditions { git rev-parse --git-dir > /dev/null 2>&1 if [[ $? == 0 ]]; then insertions=$(git --no-pager diff --numstat | awk '{sum1+=$1}END{print sum1}') - echo + $insertions + echo +$insertions fi } @@ -37,7 +37,7 @@ function gitdeletions { git rev-parse --git-dir > /dev/null 2>&1 if [[ $? == 0 ]]; then deletions=$(git --no-pager diff --numstat | awk '{sum2+=$2}END{print sum2}') - echo - $deletions + echo -$deletions fi } @@ -45,7 +45,7 @@ function git_untracked_info { git rev-parse --git-dir > /dev/null 2>&1 if [[ $? == 0 ]]; then untracked=$(git ls-files --others --exclude-standard | wc -w) - echo ⋯ $untracked + echo ⋯$untracked fi } @@ -57,10 +57,20 @@ function git_branch_info { fi } +function repo_info { + git rev-parse --git-dir > /dev/null 2>&1 + if [[ $? == 0 ]]; then + insertions=$(git --no-pager diff --numstat | awk '{sum1+=$1}END{print sum1}') + echo + else + : + fi +} + tmux_session_info=" #S:#I.#P" -branch_info="#[fg=colour24]#[fg=colour255 bg=colour65]"$(git_branch_info) +branch_info="#[fg=colour16]$(repo_info)#[fg=colour255 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) -echo "#[fg=colour255 bg=colour61]$shortened_path #[fg=colour61 bg=colour26]$SEPARATOR_RIGHT_BOLD#[fg=colour255 bg=colour26]$tmux_session_info #[fg=colour26 bg=colour65]$SEPARATOR_RIGHT_BOLD $branch_info #[fg=colour65 bg=colour22]$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" +echo "#[fg=colour255 bg=colour29]$shortened_path #[fg=colour29 bg=colour26]$SEPARATOR_RIGHT_BOLD#[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 $deletions_info #[fg=colour1 bg=colour244]$SEPARATOR_RIGHT_BOLD $untracked_info #[fg=colour244 bg=colour16]$SEPARATOR_RIGHT_BOLD" |