SamRothCA / Today-Scripts

A widget for running scripts in the Today View in OS X Yosemite's Notification Center
1.57k stars 183 forks source link

Reexecute Scripts with interval while Notification Center open #20

Closed gdelmas closed 9 years ago

gdelmas commented 9 years ago

hi there,

first of all. great extension.

is or will there be the possibility that scripts reexecute every some seconds? this would be useful for the ps cpu usage scripts for example. cpu usage changes over time and the results while opening notification center aren't the best.

it would be great that instead of having to click the label over and over again, the script could just reevaluate automatically in a specified interval while notification center is visible.

thanks, gerard

gellis12 commented 9 years ago

You can just make a bash script for this

#!/bin/sh
i=5
while [ true ]
do
    echo "This command will run once every $i seconds!"
    sleep $i
done

Replace the echo command with whatever you want to run, then point Today Scripts at the script you made.

gdelmas commented 9 years ago

it does not work. i assume Today Scripts waits for the script to finish before it updates the output

gellis12 commented 9 years ago

Right, I forgot about that... Sorry, I've got nothing then.

SamRothCA commented 9 years ago

Sure, I'll make sure the next release does this with scripts that have "run automatically" enabled.