Ariver
2026-06-11 72219babd9bf0a4ce6fc26af91ee969a8705f053
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import Foundation
 
public enum AlignerSpaceType: Equatable, Sendable {
    case user
    case fullscreen
    case system
    case unknown(Int)
}
 
public struct AlignerSpace: Equatable, Sendable {
    public let id: UInt64
    public let type: AlignerSpaceType
    public let displayUUID: String
    public let index: Int
 
    public init(id: UInt64, type: AlignerSpaceType, displayUUID: String, index: Int) {
        self.id = id
        self.type = type
        self.displayUUID = displayUUID
        self.index = index
    }
}
 
public struct AlignerDisplay: Equatable, Sendable {
    public let uuid: String
    public let physical: Bool
    public let spaces: [AlignerSpace]
 
    public init(uuid: String, physical: Bool, spaces: [AlignerSpace]) {
        self.uuid = uuid
        self.physical = physical
        self.spaces = spaces
    }
}
 
public enum AppCategory: String, CaseIterable, Equatable, Sendable {
    case finder
    case browser
    case terminal
    case editorIDE
    case chat
    case documentNotes
    case generic
}
 
public struct AlignerApp: Equatable, Sendable {
    public let bundleIdentifier: String
    public let name: String
    public let category: AppCategory
    public let isHidden: Bool
    public let executablePath: String?
    public let processIdentifier: Int32?
 
    public init(
        bundleIdentifier: String,
        name: String,
        category: AppCategory,
        isHidden: Bool = false,
        executablePath: String? = nil,
        processIdentifier: Int32? = nil
    ) {
        self.bundleIdentifier = bundleIdentifier
        self.name = name
        self.category = category
        self.isHidden = isHidden
        self.executablePath = executablePath
        self.processIdentifier = processIdentifier
    }
}
 
public struct AlignerWindow: Equatable, Sendable {
    public enum IdentifierSource: Equatable, Sendable {
        case cgWindow
        case syntheticAX
    }
 
    public let id: UInt32
    public let identifierSource: IdentifierSource
    public let app: AlignerApp
    public let title: String
    public let isMinimized: Bool
    public let isFullscreen: Bool
    public let isGhost: Bool
    public let spaceIDs: [UInt64]
 
    public init(
        id: UInt32,
        app: AlignerApp,
        title: String,
        identifierSource: IdentifierSource = .cgWindow,
        isMinimized: Bool = false,
        isFullscreen: Bool = false,
        isGhost: Bool = false,
        spaceIDs: [UInt64] = []
    ) {
        self.id = id
        self.identifierSource = identifierSource
        self.app = app
        self.title = title
        self.isMinimized = isMinimized
        self.isFullscreen = isFullscreen
        self.isGhost = isGhost
        self.spaceIDs = spaceIDs
    }
}
 
public enum WindowDisplayPolicy {
    public static func shouldDisplay(_ window: AlignerWindow) -> Bool {
        (!window.app.isHidden || window.isFullscreen) && !window.isGhost
    }
}