I see Lri's answer and you have chosen it as your correct answer. I wanted to show you a different approach that would also handle the second "feature" you requested. This method uses launchd too but that runs an applescript. Here's the applescript. Notice that I checked it using TextEdit so just change that to your application name.
property lastRunDate : missing value
set currentDate to current date
if lastRunDate is missing value then set lastRunDate to currentDate
set idleTime to (do shell script "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'") as number
-- check if the computer has been idle for 5 minutes or if 15 minutes has passed
if idleTime is greater than or equal to (5 * 60) or (currentDate - lastRunDate) is greater than or equal to (15 * 60) then
tell application "TextEdit" to activate
set lastRunDate to currentDate
end if
Here's the launchd plist. Notice this runs every 5 minutes and the applescript does the checking for your 5 minute criteria or your 15 minute criteria. You can see from this that I called the applescript "FiveMinuteRunner.scpt" and placed it on my desktop. Good luck :)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>StartInterval</key>
<integer>300</integer>
<key>ProgramArguments</key>
<array>
<string>osascript</string>
<string>/Users/hmcshane/Desktop/FiveMinuteRunner.scpt</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>Label</key>
<string>com.HAMSoftEnginnering.FiveMinuteRunner</string>
</dict>
</plist>