run plugin only when it gets to foreground