Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
123456789101112131415161718192021222324252627import CoreGraphicsimport Foundationimport RealityDriverSupport
struct DriverConsoleState: Decodable { let onConsole: Bool let loginDone: Bool let screenLocked: Bool?
private enum CodingKeys: String, CodingKey { case onConsole = "kCGSSessionOnConsoleKey" case loginDone = "kCGSessionLoginDoneKey" case screenLocked = "CGSSessionScreenIsLocked" }
static func requireCurrent() throws { guard let state = CGSessionCopyCurrentDictionary() else { throw DriverError("Safety stop: console state unavailable; input withheld") } let data = try PropertyListSerialization.data(fromPropertyList: state, format: .binary, options: 0) let value = try PropertyListDecoder().decode(Self.self, from: data) guard value.onConsole, value.loginDone, value.screenLocked != true else { throw DriverError("Safety stop: console is locked or inactive; input withheld") } }}