curtain/Sources/Curtain/main.swift
acamarata 30d5a77ffa v1.1 — settings window, modular lifecycle actions, login item, logo
Rework Curtain into a proper menu-bar app (Caffeine-style):
- SwiftUI settings window: app, on-start, on-idle, on-end, security, displays
- Modular ActionSet/ActionRunner — per-event toggles (disconnect/lock/screen-off/deactivate)
- Configurable idle timeout; open-at-login via SMAppService; optional menu bar
- Settings persisted in UserDefaults (shared with @AppStorage); salted-SHA256 password
- Drawn curtains logo (menu-bar template + offscreen-rendered app icon)
- Split into single-responsibility modules with comment blocks
2026-06-01 15:51:20 -04:00

20 lines
782 B
Swift

import Cocoa
// Curtain a privacy curtain for macOS Screen Sharing.
// Normally launches as a background menu-bar agent (no Dock icon).
//
// Hidden build helper: `Curtain --render-icon <dir>` writes an .iconset of PNGs so
// install.sh can build AppIcon.icns without shipping any image assets.
if CommandLine.arguments.contains("--render-icon"),
let dirIndex = CommandLine.arguments.firstIndex(of: "--render-icon"),
CommandLine.arguments.indices.contains(dirIndex + 1) {
CurtainIcon.exportIconset(to: CommandLine.arguments[dirIndex + 1]) // offscreen bitmap render
exit(0)
}
let app = NSApplication.shared
let delegate = AppDelegate()
app.delegate = delegate
app.setActivationPolicy(.accessory) // background agent; settings window still shows
app.run()