# vim: ft=sh # Get last run command function last_command { local h="$(history 1)"; echo "${h##*([[:space:])+([[:digit:]])+([[:space:]])}" } # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac # Load default $TERM as $TERM_TITLE if not provided by alacritty config echo $TERM_TITLE if [[ -z $TERM_TITLE ]]; then TERM_TITLE="$TERM"; fi # agetty is set to automatically log me in on tty1 # Automatically launch GUI on tty1 after login # I don't think that this is used anymore in Sericea, I think autologin is handled by SDDM # Still, it does not hurt for later distrohopping if [ "$(tty)" == '/dev/tty1' ] && [ ! "$SSH_TTY" ]; then source "${HOME}/.dotfiles/bash/bash_login" LAST_GUI=$(cat "${HOME}/.local/state/last_login_gui" 2>/dev/null) if [ -f "${HOME}/.local/state/last_login_gui" ]; then ${HOME}/scripts/${LAST_GUI}/start${LAST_GUI}.sh fi fi # Shell configuration (history, functionality, etc.) if [ -e ${HOME}/.dotfiles/bash/shell_config ]; then source ${HOME}/.dotfiles/bash/shell_config fi # Distrobox-specific or host-specific configs (loads $DISTROBOX variable, necessary for PATH) if [ -f "/run/.containerenv" ]; then source "$HOME/.dotfiles/bash/bashrc.distrobox" else source "$HOME/.dotfiles/bash/bashrc.host" fi # Configure PATH source "$HOME/.dotfiles/bash/path" # Static environment variable exports if [ -f ${HOME}/.dotfiles/bash/env_exports ]; then . "${HOME}/.dotfiles/bash/env_exports" fi # Load aliases if [ -f ${HOME}/.dotfiles/bash/bash_aliases ]; then . "${HOME}/.dotfiles/bash/bash_aliases" fi # Home Manager . $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh . ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh # Nix . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh # Rust . "$HOME/.cargo/env" # Perl eval "$(plenv init -)" source ${HOME}/.dotfiles/bash/plenv-path.sh # Set initial title echo -e -n "\033]2;Welcome to Bash - $TERM_TITLE\007" # Set window title to last command PS0='\[\e]0;$(last_command) - $TERM_TITLE\a\]' # Update prompt PROMPT_COMMAND="source ${HOME}/.dotfiles/bash/prompt.sh" # Bell when prompt is returned to mark as urgent PROMPT_COMMAND="$PROMPT_COMMAND;printf \"\a\"" # Append previous command to history immediately PROMPT_COMMAND="$PROMPT_COMMAND;history -a" # Run fetch to clarify which OS we are using if [[ -n "$(which fastfetch 2> /dev/null)" ]]; then if [ -n $DISTROBOX ] && [ -e ${HOME}/.dotfiles/fastfetch/${DISTROBOX}.jsonc ]; then fastfetch -C ${HOME}/.dotfiles/fastfetch/${DISTROBOX}.jsonc else fastfetch -C ${HOME}/.dotfiles/fastfetch/config.jsonc fi fi