#!/bin/sh

# Defining the default visual style to be used in applications that use Qt
export QT_STYLE_OVERRIDE=kvantum
export QT_QPA_PLATFORMTHEME=gnome
export QT_WAYLAND_DECORATION=adwaita


# Force language
if [ "$LANGUAGE" = "" ]; then
    export LANGUAGE=$LANG
fi


# Checks if the shell has already been changed
if [ ! -f "$HOME/.biglinux-shell-changed" ]; then
    biglinux-change-default-shell bash-power
    touch "$HOME/.biglinux-shell-changed"
fi


# Faster AMD GPU
export RADV_PERFTEST=sam,nggc,ext_ms


# OBS Studio game capture with vulkan
if [ -e "/usr/bin/obs-vkcapture" ]; then
    export OBS_USE_EGL=1
    export OBS_VKCAPTURE=1
    export VK_INSTANCE_LAYERS=VK_LAYER_OBS_vkcapture_64:VK_LAYER_VALVE_steam_overlay_64 #Fix MangoHUD overlay
fi


# Keyboard LED
if [ -e "$HOME/.config/ledkeyboard" ]; then
   change-keyboard-led on
fi


# Define the path to the cursor theme setting in dconf
dconfPath=/org/gnome/desktop/interface/cursor-theme

# Get the current cursor theme
currentTheme=$(dconf read $dconfPath)

# Check if the current theme is 'Breeze_Light'
if [ "$currentTheme" == "'Breeze_Light'" ]; then
    # Change the cursor theme to 'Bibata-Modern-Classic'
    dconf write $dconfPath "'Bibata-Modern-Classic'"
fi


# Enable automatic mounting of devices
gsettings set org.gnome.desktop.media-handling automount true


### Execute in LiveCD
if [ -e /usr/bin/startbiglive ]; then
    # Enables basic, unencrypted password storage in Chromium-based browsers
    sudo sed -i '/--password-store=basic/!s/\(exec \/usr\/lib\/brave-browser\/brave "$@" $USER_FLAGS\)$/\1 --password-store=basic/' /usr/bin/brave

    # Removes unwanted files
    rm -f "$HOME/Empty Bash" "$HOME/Empty Desktop File.desktop" "$HOME/Empty File"

    # Updates user directories
    xdg-user-dirs-update
fi

# Execute gnome-session
# exec /usr/bin/gnome-session "$@"
