Class: NSWorkspace
- Defined in:
- ext/accessibility/extras/extras.c,
ext/accessibility/extras/extras.c
Overview
A subset of Cocoa's NSWorkspace
class.
See Apple's Developer Reference for documentation on the methods available in this class.
Class Method Summary collapse
- .frontmostApplication ⇒ Object
-
.launchAppWithBundleIdentifier(bundle_id, opts) ⇒ Object
The
additonalEventParamDescriptor
option is not supported by the bridge rigt now. - .menuBarOwningApplication ⇒ Object
- .runningApplications ⇒ Object
- .sharedWorkspace ⇒ Object
- .showSearchResultsForQueryString(query) ⇒ Object
Class Method Details
.frontmostApplication ⇒ Object
264 265 266 267 268 269 |
# File 'ext/accessibility/extras/extras.c', line 264
static
VALUE
rb_workspace_frontmost_app(VALUE self)
{
return wrap_app([[NSWorkspace sharedWorkspace] frontmostApplication]);
}
|
.launchAppWithBundleIdentifier(bundle_id, opts) ⇒ Object
TODO:
One thing we want to look into is using Launch Services instead of NSWorkspace for app launching. The reason is that we will avoid the problem launching new apps that have not been registered yet. But the big thing is that we can get the PSN for the application, which will allow for more directed input using CGEvents and it also gives us a data structure to wait on that indicates when the app has properly started up.
The additonalEventParamDescriptor
option is not supported by the bridge rigt now
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'ext/accessibility/extras/extras.c', line 298
static
VALUE
rb_workspace_launch(VALUE self, VALUE bundle_id, VALUE opts)
{
NSString* identifier = unwrap_nsstring(bundle_id);
NSWorkspaceLaunchOptions options = NUM2INT(rb_hash_lookup(opts, key_opts));
BOOL result = [[NSWorkspace sharedWorkspace]
launchAppWithBundleIdentifier:identifier
options:options
additionalEventParamDescriptor:nil
launchIdentifier:nil];
[identifier release];
return result ? Qtrue : Qfalse;
}
|
.menuBarOwningApplication ⇒ Object
271 272 273 274 275 276 |
# File 'ext/accessibility/extras/extras.c', line 271
static
VALUE
rb_workspace_menu_bar_owner(VALUE self)
{
return wrap_app([[NSWorkspace sharedWorkspace] menuBarOwningApplication]);
}
|
.runningApplications ⇒ Object
251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'ext/accessibility/extras/extras.c', line 251
static
VALUE
rb_workspace_running_apps(VALUE self)
{
NSArray* apps = [[NSWorkspace sharedWorkspace] runningApplications];
VALUE rb_apps = wrap_array_apps(apps);
[apps enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[obj retain];
}];
[apps release];
return rb_apps;
}
|
.sharedWorkspace ⇒ Object
243 244 245 246 247 248 |
# File 'ext/accessibility/extras/extras.c', line 243
static
VALUE
rb_workspace_shared(VALUE self)
{
return self;
}
|
.showSearchResultsForQueryString(query) ⇒ Object
278 279 280 281 282 283 284 285 |
# File 'ext/accessibility/extras/extras.c', line 278
static
VALUE
rb_workspace_find(VALUE self, VALUE query)
{
BOOL result =
[[NSWorkspace sharedWorkspace] showSearchResultsForQueryString:unwrap_nsstring(query)];
return (result ? Qtrue : Qfalse);
}
|