#!/bin/bash
echo -e "pstopwatch \c" > /tmp/ptimer-exec
case $1 in
-stopwatch)
	if [ "$AUTOSTART" = "true" ]; then echo -e "-x \c" >> /tmp/ptimer-exec; fi
	if [ "$TENTH" = "false" ]; then echo -e "-s \c" >> /tmp/ptimer-exec; fi
	if [ "$COUNTDOWN" = "false" ]; then echo -e "-c \c" >> /tmp/ptimer-exec; fi
	if [ "$TIMER" = "true" ]; then echo -e "-t $ENTRY_TIMER \c" >> /tmp/ptimer-exec; fi
	;;
-clock)
	echo -e "-C \c" >> /tmp/ptimer-exec
	if [ "$CLOCK_ALARM" = "true" ]; then
		echo -e "-A $ENTRY_ALARM -l ::\"Alarm at ${ENTRY_ALARM/:/.}\" \c" >> /tmp/ptimer-exec
	else
		echo -e "-l \"::Clock\" \c" >> /tmp/ptimer-exec
	fi
	;;
esac
if [ "$ENTRY_WINDOWSIZE" ]; then W_SIZE="-w $ENTRY_WINDOWSIZE"; fi
echo -e "-a \"$SOUND_ALARM\" -b \"$SOUND_BEEP_LOW\" -B \"$SOUND_BEEP_HIGH\" -f \"$ENTRY_FONT\":$ENTRY_FONTSIZE $W_SIZE \c" >> /tmp/ptimer-exec
	
	chmod 700 /tmp/ptimer-exec
	/tmp/ptimer-exec
