#!/bin/bash

. /usr/bin/fly-tablet-env

#QT_IM_MODULE - Name of virtual keyboard.
#   This property is taken from /usr/share/fly-phone/vkbd/vkbd.conf.
#   If not empty environment variable will be set.
#   fly-qml-components using this to build root component.

#FLY_LAUNCHER_SETTINGS - Path to launcher QSettings (~/.config/rusbitech/fly-launcher.conf).

#FLY_PHONE_LOW_EFFECTS - If set ColorOverlay will be invisible.
#   Rectangles will be shown instead of shadows. Using 2drenderer sets this value to true.

#FLY_PHONE_DPR - QML scale factor.
#   If not set it will be calculated based on physical dpi or taken from settings.
#   Env value overrides settings value.

#FLY_PHONE_VOLUME_CONTROL - Base amixer simple control.
#   If not set it will be autoset by launcher to Master
#   or Speaker or first control found in amixer scontrols

#FLY_PHONE_KILL_AFTER - Default 3000(ms).
#   When closing windows in pager kill(SIGTERM) is called.
#   And after 3000ms if window(app) still exists then it recieve SIGKILL(unblockable)

#FLY_PHONE_VERBOSE - Verbose mode.

export GDK_BACKEND=wayland
export CLUTTER_BACKEND=wayland
export QT_QPA_PLATFORM=wayland

#export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export QT_WAYLAND_DISABLE_WINDOWDECORATION_EXCEPT_FOR_DIALOGS=1

if test -z $XDG_RUNTIME_DIR; then
 if ! test -d /tmp/weston/$USER; then mkdir -m 0700 /tmp/weston/$USER; fi
 export XDG_RUNTIME_DIR=/tmp/weston/$USER
fi

/usr/bin/fly-admin-autostart -s


if test -z $DESKTOPDIR; then
 weston-launch
else
 weston
fi
