Skip to content

Instantly share code, notes, and snippets.

@ccgus ccgus/bring to front
Created Oct 27, 2017

Embed
What would you like to do?
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
NSDictionary *activeAppDict = [workspace activeApplication];
ProcessSerialNumber psn;
psn.highLongOfPSN = [[activeAppDict objectForKey:@"NSApplicationProcessSerialNumberHigh"] intValue];
psn.lowLongOfPSN = [[activeAppDict objectForKey:@"NSApplicationProcessSerialNumberLow"] intValue];
SetFrontProcess( &psn );
// this .. causes a bit o' recursion for some reason.
//ProcessSerialNumber xpsn = { 0, kCurrentProcess };
//SetFrontProcess( & xpsn );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.