#
# /etc/bash.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

[[ $DISPLAY ]] && shopt -s checkwinsize

PS1='[\u@\h \W]\$ '

case ${TERM} in
  Eterm*|alacritty*|aterm*|foot*|gnome*|konsole*|kterm*|putty*|rxvt*|tmux*|xterm*)
    PROMPT_COMMAND+=('printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"')

    ;;
  screen*)
    PROMPT_COMMAND+=('printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"')
    ;;
esac

if [[ -r /usr/share/bash-completion/bash_completion ]]; then
  . /usr/share/bash-completion/bash_completion
fi

#if [ -z "$WAYLAND_DISPLAY" ] && [ "$XDG_VTNR" -eq 1 ]; then
#  exec Hyprland --i-am-really-stupid
#fi

_git () {
  if git branch > /dev/null 2>&1
  then
    printf "\e[48;5;069;38;5;063m\e[00m\e[48;5;069m"
    printf "  %s " "$(awk '{print $2}' <<< "$(git branch)")"
    printf "\e[00m\e[38;5;069m\e[00m"
  else
    printf "\e[38;5;063m\e[00m"
  fi
}

PS1="\n\[\e[48;5;027m\] \u \[\e[00m\]\[\e[48;5;033;38;5;027m\]\[\e[00m\]"
PS1+="\[\e[48;5;033m\] \h \[\e[00m\]\[\e[48;5;063;38;5;033m\]\e[00m\]"
PS1+="\[\e[48;5;063m\] \w \[\e[00m\]"
PS1+="\$(_git) "

# You may comment the following lines if you won't `ls' to be colorized:
eval "$(dircolors)"
umask=002

while read -r line
do
  alias "$line"
done < /etc/bash.bashaliases

source "/etc/bash.bashexports"

PATH=/games:/usr/local/sbin:/usr/local/bin:/usr/bin

# History config
HISTSIZE=1000
HISTTIMEFORMAT="%F %T "

neofetch
