#
# ~/.bashrc
#

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

# alias ls='ls --color=auto'
PS1='\[\e[38;5;249m\]+$(jobs | wc -l)\[\e[38;5;24m\][$(ip route get 1.1.1.1 2>/dev/null | awk -F"src " '"'"'NR==1{split($2,a," ");print a[1]}'"'"')\[\e[38;5;46m\]:\[\e[38;5;208m\]\W\[\e[38;5;24m\]]\$ \[\e[0m\]'

export DOTNET_CLI_TELEMETRY_OPTOUT=1
export TORCH_CUDA_VERSION="cu117"
export DXVK_HUD="fps,compiler"
export EDITOR="nvim"
export TZ='America/Denver'

# XDG
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"

# Clean ~/
# Languages
export GOPATH="$XDG_DATA_HOME/go"
export GOMODCACHE="$XDG_DATA_HOME/go/mod"
export RBENV_ROOT="$XDG_DATA_HOME/rbenv"
export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export DENO_INSTALL="$XDG_DATA_HOME/deno"
export DOTNET_CLI_HOME="$XDG_DATA_HOME/dotnet"
export PYTHON_HISTORY="$XDG_CACHE_HOME/pyhton_history"
# Programs
export LESSHIST="-"
export WINEPREFIX="$XDG_CONFIG_HOME/wine"
export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
export XAUTHORITY="$XDG_CONFIG_HOME/x11/Xauthority"
export GIT_CONFIG_GLOBAL="$XDG_CONFIG_HOME/gitconfig"
export HISTFILE="$XDG_CACHE_HOME/bash_history"
# Would need to be run as root, prevents the creation of "~/.sudo_as_admin_successful"
# echo Default !admin_flag >> /etc/sudoers.d/disable_saas

# Paths
export PATH="$PATH:$HOME/.local/bin/"
export PATH="$PATH:$CARGO_HOME/bin:$DENO_INSTALL/bin:$PYENV_ROOT/bin"

lfcd() {
	tmp="$(mktemp)"
	lfrun -last-dir-path="$tmp" "$@"
		if [ -f "$tmp" ]; then
		dir="$(cat "$tmp")"
	    rm -f "$tmp"
	    if [ -d "$dir" ]; then
	        if [ "$dir" != "$(pwd)" ]; then
				# needs to be in the .bashrc so it can cd for us
	            cd "$dir"
	        fi
	    fi
	fi
}

# Load aliases from file
if [ -f $XDG_CONFIG_HOME/aliasrc ]; then
    . $XDG_CONFIG_HOME/aliasrc
fi

