myconfigs/etc/fish/functions/fish_prompt.fish
2022-11-12 22:42:28 +05:00

34 lines
580 B
Fish

function fish_prompt
set -l last_status "$status"
set -l tty (tty)
# autostart sway on tty1
if test "$tty" = "/dev/tty1"
command sway
end
# show last exit code if != 0
if test "$last_status" -gt 0
set_color red
printf '%s ' "$last_status"
end
# show hostname on ssh connection
if test -n "$SSH_CLIENT"
set_color brblack
set -l host (uname -n)
printf '[%s] ' $host
end
# username
if test $USER = "root"
set_color -o brred
printf '\x24 '
else
set_color -o brblue
printf '\x25 '
end
set_color normal
end