2022-04-16 19:54:07 +00:00
|
|
|
# vim: ft=sh
|
|
|
|
|
2024-02-01 05:02:32 +00:00
|
|
|
# Get last run command
|
|
|
|
function last_command {
|
|
|
|
local h="$(history 1)";
|
|
|
|
echo "${h##*([[:space:])+([[:digit:]])+([[:space:]])}"
|
|
|
|
}
|
|
|
|
|
2022-04-16 19:54:07 +00:00
|
|
|
# If not running interactively, don't do anything
|
|
|
|
case $- in
|
|
|
|
*i*) ;;
|
2023-09-05 16:45:45 +00:00
|
|
|
*) return;;
|
2022-04-16 19:54:07 +00:00
|
|
|
esac
|
|
|
|
|
2024-02-01 05:33:38 +00:00
|
|
|
# Load default $TERM as $TERM_TITLE if not provided by alacritty config
|
|
|
|
echo $TERM_TITLE
|
|
|
|
if [[ -z $TERM_TITLE ]]; then
|
|
|
|
TERM_TITLE="$TERM";
|
|
|
|
fi
|
|
|
|
|
2022-04-16 19:54:07 +00:00
|
|
|
# agetty is set to automatically log me in on tty1
|
|
|
|
# Automatically launch GUI on tty1 after login
|
2024-02-01 05:32:04 +00:00
|
|
|
# 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
|
2023-02-24 01:24:59 +00:00
|
|
|
if [ "$(tty)" == '/dev/tty1' ] && [ ! "$SSH_TTY" ]; then
|
2024-02-01 05:32:04 +00:00
|
|
|
source "${HOME}/.dotfiles/bash/bash_login"
|
2024-03-08 21:23:54 +00:00
|
|
|
LAST_GUI=$(cat "${HOME}/.local/state/last_login_gui" 2>/dev/null)
|
|
|
|
if [ -f "${HOME}/.local/state/last_login_gui" ]; then
|
2022-05-27 04:34:32 +00:00
|
|
|
${HOME}/scripts/${LAST_GUI}/start${LAST_GUI}.sh
|
2022-04-16 19:54:07 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2024-02-01 05:16:09 +00:00
|
|
|
# Shell configuration (history, functionality, etc.)
|
|
|
|
if [ -e ${HOME}/.dotfiles/bash/shell_config ]; then
|
2024-02-01 05:32:15 +00:00
|
|
|
source ${HOME}/.dotfiles/bash/shell_config
|
2022-04-16 19:54:07 +00:00
|
|
|
fi
|
|
|
|
|
2024-02-01 05:35:31 +00:00
|
|
|
# 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"
|
2024-01-31 03:25:33 +00:00
|
|
|
fi
|
|
|
|
|
2024-02-01 05:34:45 +00:00
|
|
|
# Configure PATH
|
|
|
|
source "$HOME/.dotfiles/bash/path"
|
|
|
|
|
2024-02-01 05:36:08 +00:00
|
|
|
# Static environment variable exports
|
|
|
|
if [ -f ${HOME}/.dotfiles/bash/env_exports ]; then
|
|
|
|
. "${HOME}/.dotfiles/bash/env_exports"
|
|
|
|
fi
|
2022-04-16 19:54:07 +00:00
|
|
|
|
|
|
|
# Load aliases
|
2023-02-24 01:24:59 +00:00
|
|
|
if [ -f ${HOME}/.dotfiles/bash/bash_aliases ]; then
|
|
|
|
. "${HOME}/.dotfiles/bash/bash_aliases"
|
2022-04-16 19:54:07 +00:00
|
|
|
fi
|
|
|
|
|
2024-02-01 05:37:31 +00:00
|
|
|
# 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"
|
2024-02-01 04:53:28 +00:00
|
|
|
# Perl
|
|
|
|
eval "$(plenv init -)"
|
|
|
|
source ${HOME}/.dotfiles/bash/plenv-path.sh
|
2022-11-04 15:12:23 +00:00
|
|
|
|
2024-02-01 05:38:35 +00:00
|
|
|
# Set initial title
|
|
|
|
echo -e -n "\033]2;Welcome to Bash - $TERM_TITLE\007"
|
2023-01-09 03:52:24 +00:00
|
|
|
|
2024-02-01 05:31:31 +00:00
|
|
|
# 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"
|
2024-02-01 05:38:11 +00:00
|
|
|
|
|
|
|
# Run fetch to clarify which OS we are using
|
2024-01-31 04:53:38 +00:00
|
|
|
if [[ -n "$(which fastfetch 2> /dev/null)" ]]; then
|
2024-02-01 05:38:11 +00:00
|
|
|
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
|
2023-10-29 20:39:01 +00:00
|
|
|
fi
|