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
270 271 272 273 274 275 |
# File 'ext/accessibility/extras/extras.c', line 270
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
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'ext/accessibility/extras/extras.c', line 304
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
277 278 279 280 281 282 |
# File 'ext/accessibility/extras/extras.c', line 277
static
VALUE
rb_workspace_menu_bar_owner(VALUE self)
{
return wrap_app([[NSWorkspace sharedWorkspace] menuBarOwningApplication]);
}
|
.runningApplications ⇒ Object
257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'ext/accessibility/extras/extras.c', line 257
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
249 250 251 252 253 254 |
# File 'ext/accessibility/extras/extras.c', line 249
static
VALUE
rb_workspace_shared(VALUE self)
{
return self;
}
|
.showSearchResultsForQueryString(query) ⇒ Object
284 285 286 287 288 289 290 291 |
# File 'ext/accessibility/extras/extras.c', line 284
static
VALUE
rb_workspace_find(VALUE self, VALUE query)
{
BOOL result =
[[NSWorkspace sharedWorkspace] showSearchResultsForQueryString:unwrap_nsstring(query)];
return (result ? Qtrue : Qfalse);
}
|