#! /bin/bash
unset LD_LIBRARY_PATH 
unset QT_QPA_PLATFORM_PLUGIN_PATH 
unset QT_PLUGIN_PATH 
unset QML2_IMPORT_PATH
unset XDG_DATA_DIRS
export QT_QPA_PLATFORM=xcb
#export QT_WAYLAND_SHELL_INTEGRATION=kwayland-shell

# kwindowsystem need this to find platform plugin
# this makes deepin-wm-faker work
export QT_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/qt5/plugins
#export DDE_DEBUG_LEVEL=debug

export _d_disable_filedialog=1

if [ -z "$DISPLAY" ]; then
  export DISPLAY=:0
fi
if [ -z "$WAYLAND_DISPLAY" ]; then
  export WAYLAND_DISPLAY=wayland-0
fi

. "${HOME}/.dde_env"

name=`dmidecode -t 1 | awk '/Product Name:/{print $NF}'`
export SYS_PRODUCT_NAME=${name}

if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
  # tell dbus-daemon --session (and systemd --user, if running)
  # to put a minimal subset of the Xsession's environment in activated
  # services' environments
  dbus-update-activation-environment --verbose --systemd --all
fi

if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
  exec dbus-launch /usr/bin/startdde
else
  exec /usr/bin/startdde
fi
