Skip to content

Instantly share code, notes, and snippets.

@iMerica
Created February 11, 2014 02:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iMerica/8928556 to your computer and use it in GitHub Desktop.
Save iMerica/8928556 to your computer and use it in GitHub Desktop.
Identify which app or process is stealing focus on OSX
#!/usr/bin/python
from AppKit import NSWorkspace
import time
t = range(1,100)
for i in t:
time.sleep(3)
activeAppName = NSWorkspace.sharedWorkspace().activeApplication()['NSApplicationName']
print activeAppName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment