Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more
  • Loading branch information
albertz committed Sep 13, 2011
1 parent 1df7013 commit de71ff7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions chromehacking.py
Expand Up @@ -31,6 +31,7 @@
NSWindow = objc.lookUpClass("NSWindow")
app = objc.lookUpClass("NSApplication").sharedApplication()
_NSThemeCloseWidget = objc.lookUpClass("_NSThemeCloseWidget")
HoverCloseButton = objc.lookUpClass("HoverCloseButton")

#pool = NSAutoreleasePool.alloc().init()

Expand Down Expand Up @@ -405,3 +406,18 @@ def handleExecPy(self, ev, replyEv):
except:
AppScriptHandler = objc.lookUpClass("AppScriptHandler")
appScriptHandler = AppScriptHandler.alloc().init()

def getActiveUrl():
frameWins = [ w for w in app.orderedWindows() if isinstance(w, FramedBrowserWindow) and w.isVisible() ]
if len(frameWins) == 0: return None
mainWin = frameWins[0]
for w in app.appleScriptWindows():
if w.nativeHandle() is mainWin:
return w.activeTab().URL()

def make_webapp():
url = getActiveUrl()
if not url:
print >>sys.stderr, "no active URL found"
return

0 comments on commit de71ff7

Please sign in to comment.