Files
mac_without_borders/Sources/MWBMac/Permissions.swift
T
lucioandClaude Fable 5.1 671b3dfa61 bootstrap: SwiftPM skeleton, gates, bundler, and the lane procedure
Four targets (MWBCore, MWBNet, MWBMac, mwb) with a layering test that
keeps MWBCore free of AppKit/CoreGraphics/Network; tools/gates.sh as the
definition of done; tools/bundle.sh producing a signed dist/mwb.app;
tools/lane.sh for lane worktrees; smoke binary with --version and
--check-permissions. docs/loop.md records the Dev -> QA -> lead loop with
the literal dispatch prompts, the wave schedule and escalations.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-15 23:46:24 -07:00

29 lines
1.0 KiB
Swift

import CoreGraphics
/// Which macOS TCC permissions the current process holds.
///
/// `listen` is Input Monitoring (needed to observe key events), `post` is
/// Accessibility (needed to inject events and to run a swallowing tap).
public struct PermissionState: Equatable, Sendable {
/// Input Monitoring granted.
public let listen: Bool
/// Accessibility granted.
public let post: Bool
/// True when both permissions are granted.
public var isComplete: Bool { listen && post }
}
/// The one wrapper around the `CGPreflight*EventAccess` C API (CLAUDE.md,
/// Swift standards: C APIs are wrapped once). Only *preflight* lives here;
/// requesting is the `event-tap` lane's job, and never happens on an agent's
/// own initiative (CLAUDE.md, Workflow).
public enum Permissions {
/// Reads the current grants without prompting the user.
public static func preflight() -> PermissionState {
PermissionState(
listen: CGPreflightListenEventAccess(),
post: CGPreflightPostEventAccess())
}
}