91 lines
2.4 KiB
Bash
91 lines
2.4 KiB
Bash
# vim: ft=sh
|
|
|
|
# Get last run command
|
|
function last_command {
|
|
local h="$(history 1)";
|
|
echo "${h##*([[:space:])+([[:digit:]])+([[:space:]])}"
|
|
}
|
|
|
|
# Configure PATH
|
|
source "$HOME/.dotfiles/bash/path"
|
|
|
|
# If not running interactively, don't do anything
|
|
case $- in
|
|
*i*) ;;
|
|
*) return;;
|
|
esac
|
|
|
|
# agetty is set to automatically log me in on tty1
|
|
# Automatically launch GUI on tty1 after login
|
|
if [ "$(tty)" == '/dev/tty1' ] && [ ! "$SSH_TTY" ]; then
|
|
. "${HOME}/.dotfiles/bash/bash_login"
|
|
LAST_GUI=$(cat "${HOME}/.spool/last_login_gui" 2>/dev/null)
|
|
if [ -f "${HOME}/.spool/last_login_gui" ]; then
|
|
${HOME}/scripts/${LAST_GUI}/start${LAST_GUI}.sh
|
|
fi
|
|
fi
|
|
|
|
# don't put duplicate lines or lines starting with space in the history.
|
|
shopt -s histappend
|
|
HISTCONTROL=ignoreboth
|
|
HISTFILE=${HOME}/.spool/bash_history
|
|
|
|
# append to the history file, don't overwrite it
|
|
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
|
HISTSIZE=500000
|
|
HISTFILESIZE=1000000
|
|
|
|
# check the window size after each command and, if necessary,
|
|
# update the values of LINES and COLUMNS.
|
|
shopt -s checkwinsize
|
|
|
|
# enable programmable completion features
|
|
if ! shopt -oq posix; then
|
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
|
. /usr/share/bash-completion/bash_completion
|
|
elif [ -f /etc/bash_completion ]; then
|
|
. /etc/bash_completion
|
|
fi
|
|
fi
|
|
|
|
if [[ -z $TERM_TITLE ]]; then
|
|
TERM_TITLE="$TERM";
|
|
fi
|
|
|
|
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\"; history -a"
|
|
|
|
# Load aliases
|
|
if [ -f ${HOME}/.dotfiles/bash/bash_aliases ]; then
|
|
. "${HOME}/.dotfiles/bash/bash_aliases"
|
|
fi
|
|
|
|
|
|
# Set initial title
|
|
echo -e -n "\033]2;Welcome to Bash\007"
|
|
# Perl
|
|
eval "$(plenv init -)"
|
|
source ${HOME}/.dotfiles/bash/plenv-path.sh
|
|
|
|
if [ -f "/run/.containerenv" ]; then
|
|
source "$HOME/.dotfiles/bash/bashrc.distrobox"
|
|
else
|
|
source "$HOME/.dotfiles/bash/bashrc.host"
|
|
fi
|
|
|
|
source "$HOME/.cargo/env"
|
|
source ~/perl5/perlbrew/etc/bashrc
|
|
. "$HOME/.cargo/env"
|
|
# Hide errors
|
|
clear
|
|
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
|