grep --color=auto < /dev/null &>/dev/null && alias grep='grep --color=auto'
export PATH="$HOME/.local/bin:$PATH"
export PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="$PATH:/home/coast/.spicetify"
export MANPATH="/usr/pkg/man:$MANPATH"
export XDG_DATA_DIRS="/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share:/usr/local/share:/usr/share"
export EIX_LIMIT=0

#aliasrc

#OS-based aliases
[ "$(uname -s)" = "FreeBSD" ] && alias make=gmake

alias \
	sysrc="doas sysrc"\
	service="doas service"\
	sysctl="doas sysctl"\
	px="proxychains -q"\
	pkg="doas proxychains -q pkg"

alias s=ssh\ laptop
alias s1="ssh coast@seqyusphere.eu"
alias s2="ssh coast@sx7n8.tech"
alias nrs="doas nixos-rebuild switch --flake /etc/nixos#core"
alias nf="clear && fastfetch"
alias mutt="neomutt"
alias mt="neomutt"
alias emoji="cat ~/.local/src/local/share/emoji | grep"
alias cst="vi ~/.config/st/config.h"
#alias ls="ls --color=auto"
#alias ll="ls -hl"
#alias l="ls -lh"
alias la="ls -ahl"
alias smi="nvidia-smi"
alias srczsh="source ~/.zshrc"
alias battery="sb-battery"
alias quit="exit"
alias push="git push"
alias weather="curl wttr.in/masjedsoleyman"
alias las="ls"
alias c="clear"
alias cear="clear"
alias cd..="cd .."
alias ..='echo "cd .."; cd ../'
alias claer="clear"
alias clare="clear"
alias cleae="clear"
alias clera="clear"
alias hotp="htop"
alias copykey='cat ~/.local/share/vault1.key | xclip -sel clipboard'
alias mic="micro"
alias nx="nsxiv"
alias e="doas emerge --ask --verbose"
alias es="eix"
alias fe="flatpak search"
alias fei="flatpak install"
alias ac="doas emerge -ac"
alias ls="ls --color=auto"
alias alsamixer="alsamixer -c 0"
alias l="ls -l;"
alias freebsd="qemu-system-x86_64 -m 8048 -smp 2 -hda /home/coast/vm/freebsd/FreeBSD-14.3-RELEASE-amd64.qcow2 -nic user,model=virtio-net-pci -enable-kvm"
alias os="ls --color=auto"
alias lsbc="lsblk | bat -l conf"
alias main=man
alias mian=man

video() {
    mpv "$1" --ytdl-format="bestvideo[height>=720]+bestaudio/best[height>=720]"
}
videolow() {
    mpv "$1" --ytdl-format="bestvideo[height<=720]+bestaudio/best[height<=720]"
}

#else
bindkey -e
batstat=$(cat /sys/class/power_supply/BAT1/status 2>/dev/null)
charge=$(cat /sys/class/power_supply/BAT1/capacity 2>/dev/null)
if [[ "$batstat" == "Discharging" && "$charge" -lt 50 ]]; then
  echo "Battery: $(sb-battery)"
fi

noipv6(){
  doas sysctl -w net.ipv6.conf.all.disable_ipv6=1
  doas sysctl -w net.ipv6.conf.default.disable_ipv6=1
  doas sysctl -w net.ipv6.conf.lo.disable_ipv6=1
}

#PROXYCHAINS_IGNORE=(
#  cd exit clear fg bg jobs history
#  ssh scp sftp
#  proxychains
#)
#
#autoload -U add-zsh-hook
#
#_proxychains_auto() {
#    local cmd="$BUFFER"
#    [[ -z "$cmd" ]] && return
#
#    # get first word of command
#    local first=${cmd%% *}
#
#    # ignore listed commands
#    for ignore in "${PROXYCHAINS_IGNORE[@]}"; do
#        [[ "$first" == "$ignore" ]] && return
#    done
#
#    # sudo/doas handling
#    if [[ "$cmd" == sudo\ * ]]; then
#        BUFFER="sudo proxychains ${cmd#sudo }"
#    elif [[ "$cmd" == doas\ * ]]; then
#        BUFFER="doas proxychains ${cmd#doas }"
#    else
#        BUFFER="proxychains $cmd"
#    fi
#}
#
#add-zsh-hook preexec _proxychains_auto
