mirror of
https://github.com/acamarata/curtain.git
synced 2026-07-01 03:04:25 +00:00
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
20 lines
782 B
Swift
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()
|