Reputation: 411
I am looking to modify the way that task switching happens on OSX so that I can link two windows together. The main reason for this is that I am using Cinch, which allows for Windows 7 like snap on OS X.
When I setup two windows side by side, it is usually because I want to see both of them at the same time. I want to be able to link those two windows together so that when I task switch to one, the other is also brought to the front.
Can I accomplish this through an applescript or will I need to make a program similar to Cinch?
Thanks!
Upvotes: 1
Views: 179
Reputation: 4843
If you wanted to purely use Applescript you would do something like this :
set app1 to "Google Chrome"
set app2 to "TextEdit"
repeat
tell application "System Events"
set a to name of first process whose frontmost is true
if a is equal to app1 then
tell application app2 to activate
tell application app1 to activate
end if
end tell
delay 0.5
end repeat
However, this is not very efficient. You will need to continuously run this in the background. Although it wouldn't take up much, if any, resources since it's so simple.
For it to run in the background you will need to edit its .plist file and add : Application is agent (UIElement) => true
Your alternative is to make a Cocoa-Applescript or actual Cocoa-Obj-C app. This would be a little harder, but would be the best way to do it.
Upvotes: 1