https://github.com/revblaze/launchguardkit
An open source development kit for the components featured in LaunchGuard for macOS
https://github.com/revblaze/launchguardkit
cocoa macos open-source swift swiftui
Last synced: about 2 months ago
JSON representation
An open source development kit for the components featured in LaunchGuard for macOS
- Host: GitHub
- URL: https://github.com/revblaze/launchguardkit
- Owner: revblaze
- License: mit
- Created: 2022-11-19T19:21:43.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-01T05:19:30.000Z (over 3 years ago)
- Last Synced: 2025-05-07T13:51:32.027Z (about 1 year ago)
- Topics: cocoa, macos, open-source, swift, swiftui
- Language: Swift
- Homepage:
- Size: 60.5 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LaunchGuardKit
An open source development kit for the components featured in LaunchGuard for macOS.
## Setup
Drag and drop `/LaunchGuardKit` into your project.
## Getting Started
While you can use the app's localized name to interact with it, it's recommended that you mostly work with the bundle identifier instead. There are multiple benefits to this; the most important being that the `bundleId` is more unique and unlikely to change.
```swift
let launchGuard = LaunchGuard.shared
func viewDidLoad() {
// Enable debug console (optional)
LaunchGuard.debug = true
// Get currently running apps
launchGuard.apps() // ["App 1", "com.bundle.app1", "App 2", "com.bundle.app2", ...]
launchGuard.apps(.name) // ["App 1", "App 2", ...]
launchGuard.apps(.bundleId) // ["com.bundle.app1", "com.bundle.app2", ...]
}
```
## Blocklist
The Blocklist will allow you to block applications from launching by bundle identifier, name, etc.
```swift
// By bundle identifier
let list = ["com.apple.Music", "com.github.GitHubClient"]
launchGuard.add(blocklist: list)
// By app name
let list = ["Music", "GitHub Desktop"]
launchGuard.add(blocklist: list, format: .name)
```
## Commands
You can issue customizable commands to specific applications as well:
```swift
// Quit the Music app
let music = "com.apple.Music"
launchGuard.command(.quit, bundleId: music)
// Force quit multiple apps
let apps = ["com.apple.Music", "com.github.GitHubClient"]
launchGuard.commandAll(.forceQuit, bundleIds: apps)
```