#!/bin/sh

# lang exports
export LANG=en_US.UTF-8
export LC_CTYPE="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_PAPER="en_US.UTF-8"
export LC_NAME="en_US.UTF-8"
export LC_ADDRESS="en_US.UTF-8"
export LC_TELEPHONE="en_US.UTF-8"
export LC_MEASUREMENT="en_US.UTF-8"
export LC_IDENTIFICATION="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"

# wayland fixes
export XDG_SESSION_TYPE=wayland
export MOZ_ENABLE_WAYLAND=1
export GTK_USE_PORTAL=0
#export SDL_VIDEODRIVER=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
export QT_QPA_PLATFORM=wayland
export XDG_CURRENT_DESKTOP=Sway
export XDG_SESSION_DESKTOP=Sway
export WLR_NO_HARDWARE_CURSORS=1

# for electron apps
#export ELECTRON_OZONE_PLATFORM_HINT=wayland

# fix for slow loads on igpu-only mode
#
#export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json:/usr/share/glvnd/egl_vendor.d/10_nvidia.json

# gnome keyring
#eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
export SSH_AUTH_SOCK

# kde wallet
/usr/lib/pam_kwallet_init

# start sway
#status=$(sudo cat /sys/class/drm/card1-HDMI-A-2/status)
#if [ "$status" = "connected" ]; then
#export WLR_RENDERER=vulkan
#export WLR_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0
#export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/10_nvidia.json:/usr/share/glvnd/egl_vendor.d/50_mesa.json
#export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
#export GBM_BACKEND=nvidia-drm
#export __GL_GSYNC_ALLOWED=0
#export __GL_VRR_ALLOWED=0
#export XWAYLAND_NO_GLAMOR=1
#fi

#export WLR_RENDERER=gles2
#export WLR_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0
#export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/10_nvidia.json:/usr/share/glvnd/egl_vendor.d/50_mesa.json
sway --unsupported-gpu

systemctl --user stop sunshine
