最前面のアプリケーションがフルスクリーンかどうかを知る必要があります。
これを確認する必要があるのは次のとおりです( でNSApplicationPresentationOptions
のみ機能するNSApplication
ことはわかっていますが、 でそれを行う方法がわかりませんNSRunningApplication
):
NSArray *activeApps = [[[NSWorkspace sharedWorkspace] runningApplications] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"isActive==YES && bundleIdentifier!=%@", MY_BUNDLE_IDENTIFIER]];
if ([activeApps count] > 0){
NSApplicationPresentationOptions opts = [[activeApps objectAtIndex:0] presentationOptions];
timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(setupPlayer) userInfo:nil repeats:YES];
if (opts & NSApplicationPresentationFullScreen) {
//Do something
}
}
したがって、コードを実行すると、明らかに次のエラーが発生し[activeApps objectAtIndex:0]
ますNSRunningApplication
。
-[NSRunningApplication presentationOptions]: 認識されないセレクターがインスタンスに送信されました...
それを修正し、最前面のアプリケーションが全画面表示になっているかどうかを確認する方法についてのアイデアはありますか? または、これを実行する他の方法はありますか?