Mirror of https://github.com/hsiangenlinlin/air-accept.git
|
|
5 kuukautta sitten | |
|---|---|---|
| Resources | 5 kuukautta sitten | |
| Sources | 5 kuukautta sitten | |
| Tests | 5 kuukautta sitten | |
| .gitignore | 5 kuukautta sitten | |
| Makefile | 5 kuukautta sitten | |
| Package.swift | 5 kuukautta sitten | |
| README.md | 5 kuukautta sitten | |
| README.zh-TW.md | 5 kuukautta sitten |
AirAccept is a small macOS menu bar app that watches for incoming AirPlay Receiver prompts and automatically presses Accept only when the prompt clearly matches an AirPlay request.
It is intended for a Mac that already has the built-in AirPlay Receiver enabled in System Settings.
macOS can use a Mac as an AirPlay Receiver, and System Settings lets you choose who can AirPlay to it:
In practice, even when AirPlay Receiver is enabled and Allow AirPlay for is set to Anyone on the Same Network or Everyone, macOS can still show an incoming AirPlay prompt that must be manually accepted before playback starts.
AirAccept exists for Macs that are used as always-available AirPlay receivers, media machines, or headless/remote systems where manually clicking Accept every time is inconvenient.
AirAccept does not require Screen Recording and does not use AppleScript/System Events automation.
Tested on:
AirAccept uses macOS Accessibility APIs to inspect Notification Center. It should continue working as long as Apple keeps the AirPlay prompt exposed in a similar Accessibility structure, but it is not guaranteed across every macOS release.
make test
make app
The app bundle is created at:
build/AirAccept.app
To build and launch in one step:
make run
If open appears to do nothing, run the app in the foreground to see launch errors:
make debug-run
When it is running correctly from debug-run, the command stays active until you quit AirAccept or press Ctrl-C.
You can move that app bundle to /Applications after building. Keeping the app in a stable path is recommended because macOS Accessibility permissions are tied to the app identity and path.
build/AirAccept.app.AirAccept -> Request Accessibility Permission.AirAccept -> Launch at Login if you want it to start automatically when you sign in.To confirm it launched, check the log:
tail -n 20 "$HOME/Library/Logs/AirAccept/airaccept.log"
You should see a line like:
[info] ... AirAccept launched pid=12345
AirAccept creates this file on first run:
~/Library/Application Support/AirAccept/config.json
Default config:
{
"poll_interval_ms": 2500
}
poll_interval_ms controls how often AirAccept checks Notification Center for a matching AirPlay request.
You can set it from the menu bar under:
AirAccept -> Poll Interval -> 2/3/4/5 seconds
AirAccept writes newline-delimited JSON events to:
~/Library/Logs/AirAccept/airaccept.log
Each event includes timestamp, host process, prompt summary, parsed device name, action, and reason. It also writes to Apple unified logging with subsystem com.airaccept.AirAccept.
The log file rotates at about 1 MB and keeps one previous file at airaccept.log.1.
Use the menu bar item:
AirAccept -> Launch at Login
This uses SMAppService.mainApp, the macOS 13+ login item API.
AirAccept does not click arbitrary system dialogs. A prompt must contain AirPlay-specific request text, such as a device wanting to AirPlay to this Mac, and an accept-like Accessibility action before AirAccept clicks through the Accessibility path.