#!/bin/bash

# opencocon-local startup


PWROFF="/tmp/.cocon.poweroff"

if [ -e $PWROFF ];
then
  rm $PWROFF
fi

# Default running on matchbox window manager
matchbox-window-manager &
lxpanel &
connman-applet &


# Classic mode call function : 

cvnc=$COCON_VNC_HOST
cvnc_impl=$COCON_VNC_IMPL
if [ $cvnc ];
then
  cocon-vnc-launch $cvnc $cvnc_impl
  exit 0
fi


crdp=$COCON_RDP_HOST
crdp_domain=$COCON_RDP_DOMAIN
crdp_user=$COCON_RDP_USER
if [ $crdp ];
then
  cocon-freerdp-launch $crdp $crdp_user $crdp_domain
  exit 0
fi

cnet=$COCON_NETSET
if [ $cnet ];
then
  cocon-netset-launch
  exit 0
fi

# New mode menu
while :
do
  if [ -e $PWROFF ];
  then
    break
  fi
  lxterminal -e /usr/bin/cocon-menu-launch
done

# Power off runs on .profile!
