-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathPHWindow.h
84 lines (57 loc) · 1.79 KB
/
PHWindow.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Phoenix is released under the MIT License. Refer to https://github.com/kasper/phoenix/blob/master/LICENSE.md
*/
@import Cocoa;
@import JavaScriptCore;
@class PHApp;
@class PHSpace;
@class PHWindow;
#import "PHAXUIElement.h"
#import "PHIdentifiableJSExport.h"
static NSString *const PHWindowVisibilityOptionKey = @"visible";
@protocol PHWindowJSExport <JSExport, PHIdentifiableJSExport>
#pragma mark - Exported Windows
+ (instancetype)focused;
+ (instancetype)at:(CGPoint)point;
+ (NSArray<PHWindow *> *)all:(NSDictionary<NSString *, id> *)optionals;
+ (NSArray<PHWindow *> *)recent;
- (NSArray<PHWindow *> *)others:(NSDictionary<NSString *, id> *)optionals;
#pragma mark - Exported Properties
- (NSString *)title;
- (BOOL)isMain;
- (BOOL)isNormal;
- (BOOL)isFullScreen;
- (BOOL)isMinimized;
- (BOOL)isVisible;
- (PHApp *)app;
- (NSScreen *)screen;
- (NSArray<PHSpace *> *)spaces;
#pragma mark - Position and Size
- (CGPoint)topLeft;
- (CGSize)size;
- (CGRect)frame;
- (BOOL)setTopLeft:(CGPoint)point;
- (BOOL)setSize:(CGSize)size;
- (BOOL)setFrame:(CGRect)frame;
- (BOOL)setFullScreen:(BOOL)value;
- (BOOL)maximize;
- (BOOL)minimize;
- (BOOL)unminimize;
#pragma mark - Alignment
- (NSArray<PHWindow *> *)neighbors:(NSString *)direction;
#pragma mark - Focusing
- (BOOL)raise;
- (BOOL)focus;
- (BOOL)focusClosestNeighbor:(NSString *)direction;
#pragma mark - Closing
- (BOOL)close;
@end
@interface PHWindow : PHAXUIElement <PHWindowJSExport>
#pragma mark - Predicates
+ (NSPredicate *)isVisible:(BOOL)visible;
#pragma mark - Windows
+ (NSArray<PHWindow *> *)filteredWindowsUsingPredicateBlock:(BOOL (^)(PHWindow *window,
NSDictionary<NSString *, id> *bindings))block;
#pragma mark - Properties
- (CGWindowID)identifier;
@end