#!/bin/bash

# add local bin to path
export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH="/usr/lib:$LD_LIBRARY_PATH"

# explicitly set and append to XDG_DATA_DIRS
[ -z "$XDG_DATA_DIRS" ] && export XDG_DATA_DIRS="/usr/share:/usr/local/share"
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share"

# set language, editor, augment history behavior, enable dynamic resize
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
#export TERM=alacritty
export TerminalEmulator=alacritty
export EDITOR=/usr/bin/vim
export BROWSER=/usr/bin/brave
export HISTFILE="$HOME/.bash_history"
export HISTCONTROL=ignoreboth:erasedups
shopt -s histappend
shopt -s checkwinsize
shopt -s direxpand

# fcitx IME support
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx

# specify wayland for applications (primarily games)
export MOZ_ENABLE_WAYLAND=1
export SDL_VIDEODRIVER="wayland,x11"
export QT_QPA_PLATFORM=wayland
export XDG_CURRENT_DESKTOP=sway
export WINE_FULLSCREEN_FSR=1
export RADV_PERFTEST=gpl
export MANGOHUD_CONFIG="no_display,cpu_temp,gpu_temp"
export MANGOHUD=1
export _JAVA_AWT_WM_NONREPARENTING=1

# vulkan patches
export WLR_RENDERER=vulkan
# @note: sometimes it may try to pick the wrong vulkan driver
#export VK_DRIVER_FILES="/usr/share/vulkan/icd.d/radeon_icd.i686.json:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json"
# @note: machines with multiple valid gpu devices may require explicit overrides
#export WLR_DRM_DEVICES="/dev/dri/card1:/dev/dri/card0"
# @note: explicitly set device using `vulkaninfo` to get the vendorID and deviceID
#export MESA_VK_DEVICE_SELECT="VID:DID"

# if bashrc exists and the terminal has stdin load it
test -t 0 && . "$HOME/.bashrc"
