|
| 1 | +# AppJail |
| 2 | + |
| 3 | +A lightweight macOS menu bar utility that blocks distracting apps and browser tabs. |
| 4 | + |
| 5 | +AppJail sits in your menu bar and enforces focus by terminating blocked applications and closing browser tabs that match URL keywords — all powered by native macOS APIs. |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## Features |
| 12 | + |
| 13 | +- **Block Apps** — Toggle any installed application to blocked. When activated, the app is immediately terminated. |
| 14 | +- **Block Browser Tabs** — Add URL keywords (e.g. `youtube`, `reddit`, `twitter`). Matching tabs are closed when you switch to a browser. |
| 15 | +- **Menu Bar Only** — Runs entirely from the menu bar with no dock icon. |
| 16 | +- **Event-Driven** — Monitors app switches via `NSWorkspace` notifications. No polling, no CPU waste. |
| 17 | +- **Violation Alerts** — A floating panel appears briefly when a blocked app or URL is caught. |
| 18 | +- **Persistent** — Your block lists survive app restarts (stored in UserDefaults). |
| 19 | + |
| 20 | +## Supported Browsers |
| 21 | + |
| 22 | +| Browser | App Block | Tab Block | |
| 23 | +|---------|-----------|-----------| |
| 24 | +| Safari | Yes | Yes | |
| 25 | +| Google Chrome | Yes | Yes | |
| 26 | +| Microsoft Edge | Yes | Yes | |
| 27 | +| Brave | Yes | Yes | |
| 28 | +| Arc | Yes | Yes | |
| 29 | +| Dia | Yes | Yes | |
| 30 | +| Vivaldi | Yes | Yes | |
| 31 | +| Opera | Yes | Yes | |
| 32 | +| Firefox | Yes | No (no AppleScript support) | |
| 33 | + |
| 34 | +## Installation |
| 35 | + |
| 36 | +### Download |
| 37 | + |
| 38 | +Download the latest DMG from [Releases](https://github.com/devsemih/appjail/releases), open it, and drag **appjail** to your Applications folder. |
| 39 | + |
| 40 | +### Build from Source |
| 41 | + |
| 42 | +```bash |
| 43 | +git clone https://github.com/devsemih/appjail.git |
| 44 | +cd appjail |
| 45 | +xcodebuild -project appjail.xcodeproj -scheme appjail -configuration Release |
| 46 | +``` |
| 47 | + |
| 48 | +Requires **Xcode 26.2+** and **macOS 26.0+**. |
| 49 | + |
| 50 | +## Permissions |
| 51 | + |
| 52 | +AppJail needs two permissions on first launch: |
| 53 | + |
| 54 | +| Permission | Why | |
| 55 | +|---|---| |
| 56 | +| **Accessibility** | To monitor which app is frontmost and terminate blocked apps | |
| 57 | +| **Automation** | To read browser URLs and close tabs via AppleScript | |
| 58 | + |
| 59 | +The onboarding screen guides you through granting both. You can manage them later in **System Settings → Privacy & Security**. |
| 60 | + |
| 61 | +## How It Works |
| 62 | + |
| 63 | +1. AppJail observes `NSWorkspace.didActivateApplicationNotification` to detect app switches. |
| 64 | +2. When a blocked app comes to the foreground, it calls `terminate()` on the process. |
| 65 | +3. When a registered browser activates and URL keywords exist, it waits 300ms for the page to load, reads the active tab URL via AppleScript, and closes the tab if a keyword matches. |
| 66 | + |
| 67 | +No background polling. No network requests. Everything runs locally. |
| 68 | + |
| 69 | +## Architecture |
| 70 | + |
| 71 | +``` |
| 72 | +Models/ Data models and persistence (BlockList, AppInfo) |
| 73 | +Services/ Core logic (MonitoringEngine, AppScanner, BrowserRegistry, AppleScript) |
| 74 | +Views/ SwiftUI views (Dashboard, Apps tab, Browsers tab, Onboarding) |
| 75 | +``` |
| 76 | + |
| 77 | +## License |
| 78 | + |
| 79 | +MIT |
0 commit comments