Created
June 6, 2014 12:24
-
-
Save bobelev/473f29ba82e938b14c90 to your computer and use it in GitHub Desktop.
This file contains 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 characters
App.byTitle = function(title) { | |
var apps = this.runningApps(); | |
for (i = 0; i < apps.length; i++) { | |
var app = apps[i]; | |
if (app.title() === title) { | |
app.show(); | |
return app; | |
} | |
} | |
} | |
function testWindow(title){ | |
var app = App.byTitle(title); | |
if (app){ | |
api.alert(app.title()) | |
api.alert(Window.focusedWindow().title()) | |
api.alert(app.allWindows().indexOf(Window.focusedWindow())) | |
api.alert(_.indexOf(Window.allWindows(), Window.focusedWindow())) | |
api.alert(Window.focusedWindow() === Window.focusedWindow()) | |
} | |
} | |
api.bind('c', mash, function(){testWindow('Safari')}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment