Created
July 11, 2012 19:27
-
-
Save samdmarshall/3092616 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
// cg is a set of objects that describe the properties of onscreen windows (app, frame, title, etc) | |
// this is comparing all of them to find the windows that are menubar items | |
NSSet *menubar = [NSSet setWithArray:[[cg allObjects] objectsAtIndexes:[[cg allObjects] indexesOfObjectsPassingTest:^BOOL(WindowObject *obj, NSUInteger idx, BOOL *stop) { return CGRectContainsRect(SystemMenuBarRect(), CGRectMake(obj.window_origin.x, obj.window_origin.y, obj.window_size.width, obj.window_size.height)); }]]]; | |
/* | |
Notes: | |
static CGRect SystemMenuBarRect() { | |
CGRect main_bounds = CGDisplayBounds(CGMainDisplayID()); | |
CGFloat system_height = [[NSStatusBar systemStatusBar] thickness]; | |
return CGRectMake(main_bounds.origin.x, main_bounds.origin.y, main_bounds.size.width, system_height); | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment