-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathSSYProcessTyper.h
45 lines (36 loc) · 1.65 KB
/
SSYProcessTyper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#import <Cocoa/Cocoa.h>
/*
@brief Class which provides methods for reading and setting the 'type' of
the current process, where 'type' means Foreground, LSUIElement, or Background
*/
@interface SSYProcessTyper : NSObject {
}
+ (NSApplicationActivationPolicy)currentType ;
/*
@brief Transforms the current process to foreground type by setting the
current app's activation policy, activating it, and if necessary dancing
with another app to get ownership of the menu bar
@details This method features a kludge which "dances" with some other
application if macOS does not give it ownership of the menu bar immediately.
That other application is an already-running, preferably, faceless application
(so the dance is not so visible) whose bundle identifier is returned by your
app delegate's -associatedBackgroundAppBundleIdentifier method, if it responds
to that selector and such an app is found to be running. Otherwise, it dances
with Finder (because Finder is always guaranteed to be running).
In macOS 10.11, it appears that the dance may only be necessary if app is
launched is LSUIElement in Info.plist, is launched by Xcode and then
made foreground during -applicationDidFinishLaunching. If the app does get
ownership of the menu bar immediately, then the dance is not performed.
*/
+ (void)transformToForeground:(id)sender ;
/*
@brief Transforms the current process to UIElement type by setting the
current app's activation policy
*/
+ (void)transformToUIElement:(id)sender ;
/*
@brief Transforms the current process to background type by setting the
current app's activation policy
*/
+ (void)transformToBackground:(id)sender ;
@end