# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
    for rc in ~/.bashrc.d/*; do
        if [ -f "$rc" ]; then
            . "$rc"
        fi
    done
fi
unset rc
alias HandBrakeCLI='flatpak run --command=HandBrakeCLI fr.handbrake.ghb'

export SSH_AUTH_SOCK=$HOME/.bitwarden-ssh-agent.sock

# Help Sheet
function helpme() {
    echo -e "\e[32m------------- Kitty -------------\e[0m"
    echo -e "Ctrl+Shift+V           : Paste"
    echo -e "Super+Enter            : New Terminal Window"
    echo -e "Ctrl+Shift+T           : New Tab"
    echo -e "Ctrl+Shift+Arrows      : Next Tab"
    echo -e "reload                 : refresh shell"
    echo -e ""
    echo -e "\e[32m--------- System Update ---------\e[0m"
    echo -e "update                 : System Update"
    echo -e "cleanup                : Autoremove Packages"
    echo -e ""
    echo -e "\e[32m------------- Files -------------\e[0m"
    echo -e "llt                    : Tree View"
    echo -e "pack                   : pack compressed.tar.xz /folder/file1.txt /folder/folder2"
    echo -e "unpack                 : unpack file.tar.xz"
    echo -e "size                   : List files and sizes"
    echo -e "zi                     : See past filepaths"
    echo -e "ctl+R                  : Command history"
    echo -e "alt+C                  : fzf search subdirectories"
    echo -e ""
    echo -e "\e[32m------------- Docker ------------\e[0m"
    echo -e "dup                    : Docker compose up -d"
    echo -e "ddown                  : Docker compose down "
    echo -e "dupdate                : Docker compose down, pull, up"
    echo -e "drestart               : Docker compose restart"
    echo -e "dlog                   : Docker compose logs"
	echo -e ""
	echo -e "\e[32m---------- My Scripts -----------\e[0m"
	echo -e "myapps                 : Install Fedora apps"
	echo -e "phoneapps              : Install mobile apps"
    echo -e "caddy                  : Manage caddy configs"
    echo -e "compress               : Compress videos with handbrake"
    echo -e "star-update            : Update terminal from gitea"
    echo -e "star-edit              : Edit starship config"
    echo -e "rip                    : Rip a music CD"
    echo -e "wii                    : Convert Wii games"
    echo -e "nds-patcher            : Patches NDS ROMs"
    echo -e "megadrive              : Flashes Megadrive Carts"
    echo -e ""
    echo -e "\e[32m--------- System Stats ----------\e[0m"
	echo -e "kill [tab]             : Show processes to Kill"
	echo -e "btop                   : Show systems stats"
	echo -e ""
}

alias update="sudo dnf update"
alias cleanup="sudo dnf autoremove"
alias ..="z .."
alias ...="z ../.."
alias cd="z"
alias ll="lsd -1"
alias llt="lsd --tree"
alias reload="source ~/.bashrc"
alias rip='abcde -c ~/.abcde.conf'
alias size="du -shc"
alias nano="micro"
alias dup="docker compose up -d"
alias ddown="docker compose down"
alias dupdate="docker compose down && docker compose pull && docker compose up -d"
alias drestart="docker compose restart"
alias dlog="docker compose logs"
alias star-update="sudo -v && cd ~/.bash && git pull https://git.marlow.quest/ash/Starship.git && chmod +x install-fedora.sh && ./install-fedora.sh && source ~/.bashrc"
alias star-edit="nano ~/.config/starship.toml"
alias ssh="kitty +kitten ssh"
alias pack="tar -cvJf" # pack compressed.tar.xz /folder/file1.txt /folder/folder2
alias unpack="tar -xvf"
# Scripts
alias myapps="sudo -v && ~/.bash/scripts/fedora-apps.sh"
alias phoneapps="~/.bash/scripts/phone-apps.sh"
alias compress="~/.bash/scripts/compress.sh"
alias wii="~/.bash/scripts/wii.sh"
alias nds-patcher="~/.bash/scripts/nds.sh"
alias megadrive="~/.bash/scripts/megadrive.sh"
alias caddy="~/.bash/scripts/caddy.sh"

export GSK_RENDERER=cairo
eval "$(starship init bash)"
eval "$(fzf --bash)"
eval "$(zoxide init bash)"
fastfetch
cd