Compare commits

..

2 Commits

3 changed files with 56 additions and 5 deletions

View File

@@ -2,5 +2,6 @@
# ESPECIALLY DON'T EDIT this file if you're using zeesh near nuclear reactor
# control software for whatever unimaginable reason.
_zeeshdev_ignore_updates=0
_zeeshdev_ignore_updates=1
_zeeshdev_ticker_newlines=0
_zeeshdev_force_color_count=0

View File

@@ -1,8 +1,19 @@
#cols=$(stty -a | grep -Po '(?<=columns )\d+' | tr -d "\n")
if (( ${+commands[stty]} )); then
cols=$(stty -a | grep -Po '(?<=columns )\d+' | tr -d "\n")
else
cols=$COLUMNS
fi
setopt prompt_subst
kitty_available=n
if (( ${+KITTY_SHELL_INTEGRATION} )); then
kitty_available=y
[[ "$KITTY_SHELL_INTEGRATION" == "disabled" ]] && return # don't integrate if configured not to
autoload -Uz -- "${KITTY_INSTALLATION_DIR}/shell-integration/zsh/kitty-integration"
kitty-integration && unfunction kitty-integration
fi
function ticker_message () {
if [[ $_zeeshdev_ticker_newlines == 0 ]]; then
printf "\r${(l:$cols:: :)A}\r"
@@ -15,3 +26,29 @@ function ticker_message () {
function ticker_finish () {
[[ $_zeeshdev_ticker_newlines == 0 ]] && printf "\r${(l:$cols:: :)A}\r"
}
# color depth
colordepth=4
if [[ $_zeeshdev_force_color_count -gt 0 ]]; then
colorcount=$_zeeshdev_force_color_count
ticker_message "zeesh: color count set to $colorcount (fuse blown)"
elif [[ "$COLORTERM" == "truecolor" || "$COLORTERM" == "24bit" ]]; then
ticker_message "zeesh: true color detected! (via COLORTERM)"
colorcount=16000000
else case $TERM in
iterm |\
vte* |\
*-truecolor )
export COLORTERM="truecolor" # environmental consistency
ticker_message "zeesh: true color detected! (via TERM)"
colorcount=16000000
;;
*-256color )
ticker_message "256 colors detected (via TERM)"
colorcount=256
;;
*)
colorcount=$(tput colors | tr -d "\n")
ticker_message "tput reports $colorcount colors"
;;
esac fi

View File

@@ -2,7 +2,20 @@
# RPROMPT="%(?..%{$fg[red]%}%? )$RPROMPT"
function prompt_userathost () {
print "%{$fg_bold[cyan]%}%n%{$fg_bold[white]%}@%{$fg_bold[magenta]%}%m %{$fg_bold[white]%}%~"
if [[ $colorcount -gt 256 ]]; then
fgcyan="%F{#5bcffa}"
fgmagenta="%F{#f5abb9}"
fgwhite="%F{#ffffff}"
elif [[ $colorcount -eq 256 ]]; then
fgcyan="\e[38;5;39m"
fgmagenta="\e[38;5;210m"
fgwhite="\e[38;5;255m"
else
fgcyan="$fg_bold[cyan]"
fgmagenta="$fg_bold[magenta]"
fgwhite="$fg_bold[white]"
fi
print "%{$fgcyan%}%n%{$fgwhite%}@%{$fgmagenta%}%m %{$fgwhite%}%~"
}
prompt_functions+=prompt_userathost