A macOS app that prevents the dock from moving between displays in multi-monitor setups.
In macOS with multiple monitors, the dock automatically moves to whichever display your cursor approaches at the bottom edge. This can be distracting and interfere with workflow, especially when you want the dock to stay on your primary display.
DockAnchor intercepts mouse movement events and blocks the dock from moving to secondary displays. Unlike scripts that kill and restart the dock (causing flashing and animations), DockAnchor prevents the movement entirely at the system level.
- Start app at login: Automatically launch DockAnchor when you log in
- Run in background: Keep protection active even when the main window is closed
- Dock Icon: Displays a status icon in the macOS dock
- Menu Bar Icon: Shows app icon in the menu bar for quick access
- Display Selection: Choose which display the dock should stay on
- Real-time Display Detection: Detects when monitors are connected or disconnected
- Auto Fallback: Automatic fallback to Primary display when selected anchor display is removed
- Friendly Display Names: Automatically detects and displays connected monitors with user-friendly names
- Check for Updates: Automatically checks for new releases and updates
- Show DockAnchor: Provides a simple way to access the app's main window
- Anchor Display: Select which display the dock should remain on
- Status Monitoring: Real-time feedback on protection status
- Primary Display Identification: Displays the primary display in the settings
- Clone this repository
- Open
DockAnchor.xcodeproj
in Xcode - Build and run the project
- Grant accessibility permissions when prompted (required for functionality)
- Optionally enable "Start at Login" in settings
- Download the latest release from the releases page
DockAnchor requires accessibility permissions to function properly. This allows the app to:
- Monitor mouse movement events across all displays
- Intercept dock trigger events on secondary displays
- Provide seamless dock movement prevention
To grant permissions:
- When first launched, DockAnchor will prompt for accessibility access
- Go to System Preferences → Security & Privacy → Privacy → Accessibility
- Click the lock icon to make changes
- Add DockAnchor to the list and check the box
- Restart DockAnchor if needed
Note: Without accessibility permissions, DockAnchor cannot prevent dock movement between displays.
- Launch DockAnchor
- Click "Start Protection" to begin monitoring
- Grant accessibility permissions when prompted (see above)
- The dock will now be anchored to your selected display
- Shows protection status (green = active, red = inactive)
- Right-click for quick access to controls
- Left-click to open the main window
- Displays current anchor display and protection status
- Start at Login: Automatically launch DockAnchor when you log in
- Run in Background: Keep protection active even when window is closed
- Show Menu Bar Icon: Display status icon in menu bar
- Hide from Dock: Hide the app from the dock when running (access via menu bar only)
- Anchor Display: Choose which display the dock should stay on
- Display Detection: Automatically detects all connected displays with friendly names
- Primary Display Support: Special handling for primary display designation
DockAnchor works by:
- Event Monitoring: Creates a low-level event tap to monitor mouse movements
- Zone Detection: Calculates dock trigger zones on secondary displays
- Event Blocking: Prevents mouse events from reaching the dock when in trigger zones
- Status Tracking: Provides real-time feedback on protection status
- Display Management: Uses system APIs to get actual display names and positions
This approach is superior to dock-killing scripts because:
- No visual flashing or animations
- No interruption to running applications
- No dock restart delays
- Seamless user experience
- macOS 10.15 (Catalina) or later
- Accessibility permissions (required)
- Multiple displays (for the feature to be useful)
- Accessibility: Required to monitor mouse events and control system behavior
- Apple Events: Used to force dock positioning when needed
- SwiftUI: Modern declarative UI framework
- Core Data: Settings and preferences storage
- Accessibility APIs: System-level event monitoring
- Menu Bar Integration: Background operation support
- Display Detection: System profiler integration for display names
DockAnchor:
- Only monitors mouse movement events
- Does not collect or transmit any personal data. none.
- Runs entirely locally on your machine
- Source code is open and auditable
- Requires accessibility permissions for core functionality
git clone https://github.com/yourusername/DockAnchor.git
cd DockAnchor
open DockAnchor.xcodeproj
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly on multiple monitor setups
- Ensure accessibility permissions work correctly
- Submit a pull request
MIT License - see LICENSE file for details.
For issues, feature requests, or questions:
- Open an issue on GitHub
- Provide system information (macOS version, monitor setup)
- Include accessibility permission status
- Include steps to reproduce any problems
- Check the troubleshooting section above first
If you find my work helpful, please consider: