.dotfiles/bash/bashrc

115 lines
2.9 KiB
Bash
Raw Normal View History

2022-04-16 19:54:07 +00:00
# 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"
# GUI themes
export GTK_THEME="Gruvbox"
export ICON_THEME="Gruvbox"
export CURSOR_THEME="FlatbedCursors-White"
export PROFILE_NAME="Oled"
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_QPA_PLATFORM="wayland-egl;wayland;xcb"
export GDK_BACKEND="wayland"
export DCONF=".config/dconf/user"
2023-07-20 19:54:00 +00:00
# Setup editor
2024-01-31 03:23:56 +00:00
export EDITOR="nvim"
2023-07-20 19:54:00 +00:00
2022-04-16 19:54:07 +00:00
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
2022-04-16 19:54:07 +00:00
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
2022-04-16 19:54:07 +00:00
fi
fi
# don't put duplicate lines or lines starting with space in the history.
shopt -s histappend
HISTCONTROL=ignoreboth
2022-12-13 03:44:24 +00:00
HISTFILE=${HOME}/.spool/bash_history
2022-04-16 19:54:07 +00:00
# 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
2022-04-16 19:54:07 +00:00
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"
2022-04-16 19:54:07 +00:00
# Load aliases
if [ -f ${HOME}/.dotfiles/bash/bash_aliases ]; then
. "${HOME}/.dotfiles/bash/bash_aliases"
2022-04-16 19:54:07 +00:00
fi
# Android configs
JDK_HOME=/etc/java
STUDIO_JDK=/usr/lib/jvm/jre-openjdk
2022-11-04 22:35:26 +00:00
export LANG="C.UTF-8"
export LC_ALL="C.UTF-8"
export LC_CTYPE="C.UTF-8"
2022-04-16 19:54:07 +00:00
export LANGUAGE="en_US:en"
# terminal type
export TERM="xterm"
# Set initial title
echo -e -n "\033]2;Welcome to Bash\007"
2024-02-01 04:53:28 +00:00
# Perl
eval "$(plenv init -)"
source ${HOME}/.dotfiles/bash/plenv-path.sh
2022-12-13 03:44:24 +00:00
if [ -f "/run/.containerenv" ]; then
source "$HOME/.dotfiles/bash/bashrc.distrobox"
2022-11-05 01:52:19 +00:00
else
source "$HOME/.dotfiles/bash/bashrc.host"
2022-11-05 01:52:19 +00:00
fi
2023-01-09 03:52:24 +00:00
source "$HOME/.cargo/env"
2023-10-24 17:13:01 +00:00
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
2024-01-12 04:57:55 +00:00
else
fastfetch -C ${HOME}/.dotfiles/fastfetch/config.jsonc
2024-01-12 04:57:55 +00:00
fi
fi