Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940import CoreGraphicsimport Foundation
struct TabViewConsoleSession: Decodable, Sendable { 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 requireUnlockedConsole() throws { guard let dictionary = CGSessionCopyCurrentDictionary() else { throw RealityError( "Safety stop: Tab View reality requires a signed-in, active, unlocked desktop; console state is unavailable" ) } let session: Self do { let data = try PropertyListSerialization.data(fromPropertyList: dictionary, format: .binary, options: 0) session = try PropertyListDecoder().decode(Self.self, from: data) } catch { throw RealityError( "Safety stop: Tab View console state could not be verified: \(error). Input is withheld.") } try session.requireUnlocked() }
func requireUnlocked() throws { guard onConsole, loginDone, screenLocked != true else { throw RealityError( "Safety stop: Tab View reality requires an active unlocked desktop: onConsole=\(onConsole), loginDone=\(loginDone), screenLocked=\(String(describing: screenLocked)). Input is withheld." ) } }}