Revisions
-
ljos revised this gist
Oct 21, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ # Copyright @ Bjarte Johansen 2012 # License: http://ljos.mit-license.org/ from AppKit import NSApplication, NSApp, NSWorkspace from Foundation import NSObject, NSLog -
ljos created this gist
Jul 3, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ # This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. # Copyright @ Bjarte Johansen 2012 from AppKit import NSApplication, NSApp, NSWorkspace from Foundation import NSObject, NSLog from PyObjCTools import AppHelper from Quartz import kCGWindowListOptionOnScreenOnly, kCGNullWindowID, CGWindowListCopyWindowInfo class AppDelegate(NSObject): def applicationDidFinishLaunching_(self, notification): workspace = NSWorkspace.sharedWorkspace() activeApps = workspace.runningApplications() for app in activeApps: if app.isActive(): options = kCGWindowListOptionOnScreenOnly windowList = CGWindowListCopyWindowInfo(options, kCGNullWindowID) for window in windowList: if window['kCGWindowOwnerName'] == app.localizedName(): NSLog('%@', window) break break AppHelper.stopEventLoop() def main(): NSApplication.sharedApplication() delegate = AppDelegate.alloc().init() NSApp().setDelegate_(delegate) AppHelper.runEventLoop() if __name__ == '__main__': main()