#!/bin/bash

reso=$(xrandr | grep -m1 "*+" | awk '{ print $1 }' | cut -c -4)
if [ "$reso" -ge 3840 ]; then
    export QT_AUTO_SCREEN_SET_FACTOR=0
    export QT_SCALE_FACTOR=2
    export QT_FONT_DPI=192
else
    if [ "$reso" -ge 2048 ]; then
	export QT_AUTO_SCREEN_SET_FACTOR=0
	export QT_SCALE_FACTOR=1.3
	export QT_FONT_DPI=144
    fi
fi
cat <<'EOF' > /etc/skel/.config/kwalletrc
[Wallet]
Enabled=false

EOF

# Force Plasma themeing
export QT_PLATFORM_PLUGIN=kde
export KDE_FULL_SESSION=TRUE
export KDE_SESSION_VERSION=5
export QT_QPA_PLATFORMTHEME=Breeze

/usr/bin/_tuxedo.calamares -d 8 --xdg-config "$@"

if [ -d /tmp/calamares-root-* ]; then
    umount -R /tmp/calamares-root*
    rmdir /tmp/calamares-root*
fi
