views:

169

answers:

2

How can I bring my RubyCocoa application to the front? Basically I want to acheive the same result as the applescript line:

tell application "Whatever" to activate
+2  A: 

In Cocoa you would bring your app forward with NSApplication's -activateIgnoringOtherApps:. Presumably you can make that call through the RubyCocoa bridge.

smorgan
Awesome, thanks!!!
Josh
+1  A: 

There are definitely valid uses for this, and I'm sure you know what you're doing, but just keep in mind that if you use this inappropriately, Mac users will chase you down with pitchforks and shotguns. Apps stealing focus when the user is busy working with something else doesn't really fly on OS X.

Burke
@Burke, you are correct on both counts -- Mac users would chase me down, but I also know what I'm doing :-) What I am doing is creating a wrapper around the Synergy screen sharing program [ http://synergy2.sourceforge.net/ ]. When the user places the cursor off the Mac's screen and onto the screen of another system, I want my (windowless) wrapper to come to the front. Reason being then mouse drivers can change mouse wheel acceleration.
Josh