[PD] how to tell if pd is in the background/foreground