mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-13 19:10:39 +00:00
17 lines
528 B
Swift
17 lines
528 B
Swift
import CoreGraphics
|
|
import Foundation
|
|
import OpenClawKit
|
|
|
|
enum SystemPresenceInfo {
|
|
static func lastInputSeconds() -> Int? {
|
|
let anyEvent = CGEventType(rawValue: UInt32.max) ?? .null
|
|
let seconds = CGEventSource.secondsSinceLastEventType(.combinedSessionState, eventType: anyEvent)
|
|
if seconds.isNaN || seconds.isInfinite || seconds < 0 { return nil }
|
|
return Int(seconds.rounded())
|
|
}
|
|
|
|
static func primaryIPv4Address() -> String? {
|
|
NetworkInterfaces.primaryIPv4Address()
|
|
}
|
|
}
|