homes/common/.config/fish/functions/prompt_login.fish

47 lines
1.5 KiB
Fish
Raw Normal View History

2023-09-04 16:14:08 +02:00
#!/usr/bin/env fish
#
# From official prompt_login.fish of fish
function prompt_login --description "display user name for the prompt"
set -f color_dark_text 131a24
2023-09-06 02:22:26 +02:00
set -f color_venv 71839b
2023-09-04 16:14:08 +02:00
set -f color_cwd $fish_color_cwd
2023-09-06 02:22:26 +02:00
set -f color_user $fish_color_user
2023-09-04 16:14:08 +02:00
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
2023-09-06 02:22:26 +02:00
set -f color_cwd $fish_color_cwd_root
set -f color_user $fish_color_cwd_root
2023-09-04 16:14:08 +02:00
end
end
if not set -q __fish_machine
set -g __fish_machine
2023-09-06 02:22:26 +02:00
set -f debian_chroot $debian_chroot
2023-09-04 16:14:08 +02:00
if test -r /etc/debian_chroot
2023-09-06 02:22:26 +02:00
set -f debian_chroot (cat /etc/debian_chroot)
2023-09-04 16:14:08 +02:00
end
if set -q debian_chroot[1]
and test -n "$debian_chroot"
set -g __fish_machine "(chroot:$debian_chroot)"
end
end
# Prepend the chroot environment if present
if set -q __fish_machine[1]
echo -n -s (set_color -b $fish_color_quote $color_dark_text) "$__fish_machine" (set_color -b $fish_color_user $fish_color_quote)
end
# If we're running via SSH, change the host color.
set -l color_host $fish_color_host
if set -q SSH_TTY; and set -q fish_color_host_remote
2023-09-06 02:22:26 +02:00
set -f color_host $fish_color_host_remote
2023-09-04 16:14:08 +02:00
end
2023-09-06 02:22:26 +02:00
echo -n -s (set_color -b $color_user $color_dark_text) "$USER"
2023-09-06 02:28:03 +02:00
echo -n -s (set_color -b $color_host $color_user)
2023-09-06 02:22:26 +02:00
echo -n -s (set_color -b $color_host $color_dark_text) (prompt_hostname)
echo -n -s (set_color -b $color_venv $color_host)
2023-09-04 16:14:08 +02:00
end