#!/bin/bash

# where is our location of this script?
DIR="$(dirname -- "$(readlink -f "${BASH_SOURCE}")")"

# where is our sketch? path to the folder, not .pde!
SKETCH=$DIR"/../pde/jitakami/"

# is your processing-java in $PATH?
PROCESSING="processing-java"
#PROCESSING="/home/random/.local/src/processing/processing/processing-java"

# depends on how your dual-head is setup
# see also processing preferences for secondary display setting
#export DISPLAY=":0"

# needed on my awesome window manager
wmname LG3D

# restart on exit/kill. use "entr killall java" to restart on save:
# ls ~/PROJECTS/INTERFACE\ FRACTURES/IF4Q/pde/IF4Q/*.pde | entr killall java
while (true)
do
    echo "


";
    echo "---------------------------------------------------"
    echo "Hello to JITAKAMI!"
    echo
    echo "~~~ Processing version:..."
    # clear

    # version of processing?
    processing-java --help|grep "Command line"

    echo
    echo "~~~ Program starting  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "

    $PROCESSING \
    --force \
    --sketch="$SKETCH" \
    --run \
    --output="$SKETCH"/output

    echo	
    echo "~~~ Program has quit. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
    echo
done
