Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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