made segment params optional and better prefix status

This commit is contained in:
2023-03-24 17:56:28 +01:00
parent 588901459b
commit 74f7e49a25
4 changed files with 46 additions and 15 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.swp

View File

@@ -51,7 +51,7 @@ set -g mouse on
set -g status-bg colour235
set -g status-fg colour255
set -g status-left '#(sh ~/.tmux/health-indicator.sh #{client_prefix})#S #(~/.tmux/segment.sh end 31 29) ▣ #{session_windows} #{?session_many_attached,#(~/.tmux/subsegment.sh end) 🖥 #{session-attached},}#(~/.tmux/segment.sh end 29 71) #[fg=colour235]#H #(~/.tmux/segment.sh end 71 65) #[fg=colour235]#(whoami) #(~/.tmux/segment.sh end 65 235)'
set -g status-left '#(sh ~/.tmux/health-indicator.sh #{client_prefix})#(~/.tmux/segment.sh end 24 29) ▣ #{session_windows} #{?session_many_attached,#(~/.tmux/subsegment.sh end) 🖥 #{session-attached},}#(~/.tmux/segment.sh end 29 71) #[fg=colour235]#H #(~/.tmux/segment.sh end 71 65) #[fg=colour235]#(whoami) #(~/.tmux/segment.sh end 65 235)'
set -g status-left-length 80
set -g status-right-length 120
set -g status-justify centre

View File

@@ -1,23 +1,31 @@
#!/bin/bash
cnormal1='colour24'
cnormal2='colour255'
cnormal='colour255'
cprefix='colour238'
bnormal='colour24'
bprefix='colour208'
bprefix='colour172'
normal='●'
prefix='▲'
if [ $1 -eq 1 ]; then
printf "#[fg=$cprefix,bg=$bprefix] $prefix "
fore=$cnormal
back=$bnormal
sym=$normal
text="#S"
else
if [ $(($(date +%s) % 2)) -eq 0 ]; then
printf "#[fg=$cnormal1,bg=$bnormal] $normal "
else
printf "#[fg=$cnormal2,bg=$bnormal] $normal "
fi
fore=$cprefix
back=$bprefix
sym=$prefix
text="#[bold]⌥#[unbold]"
fi
if [ $(($(date +%s) % 2)) -eq 0 ]; then
printf "#[fg=$back,bg=$back] $sym #[fg=$fore]$text "
else
printf "#[fg=$fore,bg=$back] $sym #[fg=$fore]$text "
fi
#printf "#[fg=white,bg=red] $(date +%N) $@"
printf "#[fg=white]"

View File

@@ -1,26 +1,48 @@
#!/bin/bash
if [ -z "$1" ] ; then
printf "#[fg=white,bg=red]\ue0b2"
exit -1
fi
side=$1
case $1 in
if [ -n "$3" ] && [[ $3 =~ ^[0-9]+$ ]] ; then
# $3 was provided and is a number
from=$2
to=$3
shape=$4
echo "1"
elif [ -z "$3" ] ; then
# $3 was null
to=$2
echo "2"
else
# $3 was provided but not a number (assumed shape)
to=$2
shape=$3
echo "3"
fi
case $side in
start)
case $4 in
case $shape in
round)
separator="\ue0b6";;
sharp | *)
separator="\ue0b2";;
esac
echo -e "#[fg=colour$3,bg=colour$2]$separator#[fg=white,bg=colour$3]";;
echo -e "#[fg=colour$to,bg=colour$from]$separator#[fg=white,bg=colour$to]";;
end)
case $4 in
case $shape in
round)
separator="\ue0b4";;
sharp | *)
separator="\ue0b0";;
esac
echo -e "#[fg=colour$2,bg=colour$3]$separator#[fg=white]";;
echo -e "#[fg=colour$from,bg=colour$to]$separator#[fg=white]";;
esac