#!/bin/bash -x

SCRIPTPATH=$(dirname $(realpath $0))

if [ "$1" == "keyboard" ]; then
    if [ -e /home/smartix/machine/data/refs/point.json ]
        then key=$(cat /home/smartix/machine/data/refs/point.json | awk '/lockDesktopOnKeyboard/{print $2}' | cut -d "," -f1)
        if [[ ${key} == "true" ]]; then
        $SCRIPTPATH/secure.sh on-keyboard &
        else exit 0
        fi
    else exit 0
    fi
fi


if [ "$1" == "mouse" ]; then
    /home/smartix/machine/bin/display-screen.sh
fi

if [ "$1" == "display" ]; then
    /home/smartix/machine/bin/display-screen.sh
fi


