macOS: Simplify detecting the type of an Apple event
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
40b1f0bac8
commit
70d19691a7
|
@ -13,9 +13,5 @@ class LaunchedAtLoginDetector {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func isOpenEvent(_ event: NSAppleEventDescriptor) -> Bool {
|
private func isOpenEvent(_ event: NSAppleEventDescriptor) -> Bool {
|
||||||
if let eventClassDescriptor = event.attributeDescriptor(forKeyword: keyEventClassAttr),
|
return event.eventClass == kCoreEventClass && event.eventID == kAEOpenApplication
|
||||||
let eventIdDescriptor = event.attributeDescriptor(forKeyword: keyEventIDAttr) {
|
|
||||||
return eventClassDescriptor.typeCodeValue == kCoreEventClass && eventIdDescriptor.typeCodeValue == kAEOpenApplication
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,7 @@ class MacAppStoreUpdateDetector {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func isQuitEvent(_ event: NSAppleEventDescriptor) -> Bool {
|
private func isQuitEvent(_ event: NSAppleEventDescriptor) -> Bool {
|
||||||
if let eventClassDescriptor = event.attributeDescriptor(forKeyword: keyEventClassAttr),
|
return event.eventClass == kCoreEventClass && event.eventID == kAEQuitApplication
|
||||||
let eventIdDescriptor = event.attributeDescriptor(forKeyword: keyEventIDAttr) {
|
|
||||||
return eventClassDescriptor.typeCodeValue == kCoreEventClass && eventIdDescriptor.typeCodeValue == kAEQuitApplication
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func getExecutablePath(from pid: pid_t) -> String? {
|
private func getExecutablePath(from pid: pid_t) -> String? {
|
||||||
|
|
Loading…
Reference in New Issue