commit 59e2630670aa20c7f67f1a53e9432f62e5abbb19
parent d5dbdaa4165689a9a13955d193d7bfb22c3c0e58
Author: spacehobo <spacehobo@web>
Date: Sat, 16 May 2026 21:00:19 +0200
fixes for colour detection/uncoloured output
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/spacehobo.mdwn b/spacehobo.mdwn
@@ -17,15 +17,16 @@ GIT_PS1_SHOWUPSTREAM='auto'
# prompt, which is faster than shelling out to test data
_noop[0]='array accesses turn 0/nonzero into defined/undef!'
-if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
- # We have color support.
+case "$TERM" in alacritty*|kitty*|foot*|*color) color_prompt=yes;; esac
+
+if [ "$color_prompt" = yes ]; then
GIT_PS1_SHOWCOLORHINTS='y'
else
# simpler, uncoloured version
unset GIT_PS1_SHOWCOLORHINTS
PS1='\$ '
type -t __git_ps1 > /dev/null && PS1='$(__git_ps1 "{%s}")'$PS1
- PS1='${SSH_CONNECTION:+\h:}\w'
+ PS1='${SSH_CONNECTION:+\h:}\w'$PS1
PS1='${_tty:+\u${DOAS_USER:+<$DOAS_USER>}${SUDO_USER:+<$SUDO_USER>}@}'$PS1
PS1='${debian_chroot:+($debian_chroot)}'$PS1
PS1='${_noop[$(($?==0))]:+($?)}${_noop[$((\j==0))]:+[\j]}'$PS1