# locale
export LANG=en_US.UTF-8
export LC_COLLATE=C

# wayland
export _JAVA_AWT_WM_NONREPARENTING=1
export MOZ_ENABLE_WAYLAND=1
export MOZ_USE_XINPUT2=1
export WLR_NO_HARDWARE_CURSORS=0
export GDK_BACKEND=wayland,x11
export SDL_VIDEODRIVER=wayland
export CLUTTER_BACKEND=wayland
export ELM_DISPLAY=wl
export QT_AUTO_SCREEN_SCALE_FACTOR=1
export QT_QPA_PLATFORM="wayland;xcb"
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1

# xdg
export XDG_RUNTIME_DIR=/run/user/$(id -u)
export XDG_CONFIG_HOME=$HOME/.config
export XDG_DATA_HOME=$HOME/.local/share
export XDG_DATA_DIRS=/usr/local/share:/usr/share
export XDG_DATA_DIRS=$XDG_DATA_DIRS:/var/lib/flatpak/exports/share
export XDG_DATA_DIRS=$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share
export PATH=$PATH:$HOME/.cargo/bin
export PATH=$PATH:/var/lib/flatpak/exports/bin

# programs
export TERMINAL=kitty
export EDITOR=nvim
export CC=$(which gcc)
export LD=$(which gcc)

# theming
export QT_QPA_PLATFORMTHEME=gtk2
export GTK_THEME=Mint-Y-Dark-Teal
export XCURSOR_THEME=Adwaita
export XCURSOR_SIZE=24

# nvidia
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __NV_PRIME_RENDER_OFFLOAD=1
export __VK_LAYER_NV_optimus=NVIDIA_only

# nvk
#export MESA_LOADER_DRIVER_OVERRIDE=zink
#export NOUVEAU_USE_ZINK=1

if [ -n "$TMUX" ]; then
    return
fi

clear
printf "\t\n\t\n\t\n\t\n"
echo "\tPlease select an environment..."
echo "\t[S]way [H]yprland [T]erminal [E]xit"
printf "\t\n\t\n\t"

while true; do
    stty raw -echo
    choice=$(dd bs=1 count=1 2> /dev/null)
    stty -raw echo
    launch() {
            mkdir -p "$HOME/.log"
            echo "Launching $1..."
            export XDG_CURRENT_DESKTOP="$1"
            exec dbus-run-session "$1" &> "$HOME/.log/$1"
    }
    case "$choice" in
        "s")
            launch sway
            ;;
        "h")
            launch Hyprland
            ;;
        "t")
            exec cage -s kitty -- -o font_size=14 &> $HOME/.log/kitty
            ;;
        "e")
            exit
            ;;
        "d")
            break
            ;;
    esac
done