#!/bin/bash

# This file is sourced by /etc/X11/fly-dm/Xsession, not executed.

#export GTK_USE_PORTAL=1

#by A.Kovalenko (BT-10204)
if [ -d /parsecfs ]; then
 rm -f /run/user/$(id -u)/pulse/native
fi

IS_TOUCH=
fly-wmfunc FLYWM_GET_TOUCHSCREEN > /dev/null
if [ $? -eq "0" ]; then
 IS_TOUCH=yes
 export MOZ_USE_XINPUT2=1
fi

FLY_VM_NAME=
VM=$(systemd-detect-virt -v)
if [ $? -eq "0" ]; then
  export FLY_VM_NAME=$VM
else
  #it is really required if autologin only
  if [ ! -z ${FLY_AUTOLOGIN} ]; then
    /usr/bin/fly-dm-set-dpi.sh
  fi
fi

if [ -f /etc/X11/fly-dm/dpi ]; then
  hdpi=`cat /etc/X11/fly-dm/dpi`
  if [ ! -z "$hdpi" ]; then
    if [ "$hdpi" -gt "120" ]; then
      export QT_AUTO_SCREEN_SCALE_FACTOR=1
      export QT_ENABLE_HIGHDPI_SCALING=1
    fi
  fi
fi

#alex: check free space (optional)
/usr/bin/fly-dm-check-space.sh "$HOME"
