#!/bin/sh

# SPDX-FileCopyrightText: 2019-2021 Aleix Pol <apol@kde.org>
# SPDX-FileCopyrightText: 2019-2021 Bhushan Shah <bshah@kde.org>
# SPDX-FileCopyrightText: 2019-2020 Jonah Brüchert <jbb@kaidan.im>
# SPDX-License-Identifier: GPL-2.0-or-later

[ -f /etc/profile ] && . /etc/profile

export QT_QPA_PLATFORMTHEME=KDE
export EGL_PLATFORM=wayland

export QT_QUICK_CONTROLS_STYLE=org.kde.breeze
export QT_ENABLE_GLYPH_CACHE_WORKAROUND=1
export QT_QUICK_CONTROLS_MOBILE=true
export PLASMA_INTEGRATION_USE_PORTAL=1
export PLASMA_PLATFORM=phone:handset

# Set ~/.config/plasma-mobile/... as location for default mobile configs (i.e. envmanager generated)
export XDG_CONFIG_DIRS="$HOME/.config/plasma-mobile:/etc/xdg:$XDG_CONFIG_DIRS"

# if coredumpd knows about the dumps, make sure drkonqi catches them
if grep -q '/systemd-coredump' /proc/sys/kernel/core_pattern
then
	export KDE_COREDUMP_NOTIFY=1
fi

# ensure that we have our environment settings set properly prior to the shell being loaded (otherwise there is a race condition with autostart)
QT_QPA_PLATFORM=offscreen plasma-mobile-envmanager --apply-settings

# start the shell
export PLASMA_DEFAULT_SHELL=org.kde.plasma.mobileshell
startplasma-wayland
