Skip to content

Instantly share code, notes, and snippets.

@sephamorr
Created May 18, 2016 06:09
Show Gist options
  • Save sephamorr/259e316c33f4adda3eae0ec486379d5c to your computer and use it in GitHub Desktop.
Save sephamorr/259e316c33f4adda3eae0ec486379d5c to your computer and use it in GitHub Desktop.
#import <AppKit/NSScreen.h>
#import <AppKit/AppKit.h>
#import <Foundation/NSString.h>
#import <Foundation/NSNotification.h>
#import <CoreGraphics/CoreGraphics.h>
// #include <stdio.h>
#include <pthread.h>
#include <unistd.h>
int main()
{
for(int i=0;i<20;i++)
{
sleep(1);
NSArray *screens = [NSScreen screens];
NSLog(@"Screens=%lu",[screens count]);
for (NSScreen *screen in screens) {
NSLog(@"%@", [[screen deviceDescription] objectForKey:@"NSScreenNumber"]);
NSPoint origin = [screen frame].origin;
NSLog(@"(%d,%d):%x", (int)origin.x,(int)origin.y,[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment