A lightweight macOS menu bar app that automatically keeps your Dock on your primary external display.
When using a MacBook with an external monitor as the primary display, macOS often fails to keep the Dock on the external screen—especially when the MacBook is positioned below the external display. The Dock tends to "stick" to the MacBook screen, forcing you to manually move it every time.
DockManager monitors your display configuration and automatically repositions the Dock to a free edge on your primary screen (left or right) where no other display is connected. This ensures the Dock stays on your main working display.
Key features:
- Automatically detects display arrangement changes
- Moves Dock to a free edge when external display is connected
- Restores your preferred Dock position when you disconnect
- Runs silently in the menu bar
- No configuration needed—just works
-
Clone the repository:
git clone https://github.com/croustibat/DockManager.git cd DockManager -
Compile the app:
swiftc -o DockManager DockManager.swift -framework Cocoa
-
Run it:
./DockManager
-
(Optional) Install as a LaunchAgent to start automatically:
./install.sh
Once running, DockManager appears in your menu bar with a display icon. It works automatically, but you can also:
- Force Dock to primary screen (⌘D) - Manually trigger repositioning
- Position submenu - Choose Left/Bottom/Right manually
- Show screen info (⌘I) - Debug display configuration
- On launch: Saves your current Dock position as your "preferred" position
- When external display connects: Detects if your preferred edge is blocked by another screen and moves the Dock to a free edge
- When external display disconnects: Restores your preferred Dock position
- macOS 10.15 (Catalina) or later
- Xcode Command Line Tools (for compilation)
xcode-select --install./uninstall.shOr manually:
launchctl unload ~/Library/LaunchAgents/com.baptiste.dockmanager.plist
rm ~/Library/LaunchAgents/com.baptiste.dockmanager.plist
rm /usr/local/bin/DockManagerDockManager/
├── DockManager.swift # Main Swift application
├── diagnose.swift # Diagnostic tool for screen geometry
├── com.baptiste.dockmanager.plist # LaunchAgent for auto-start
├── install.sh # Installation script
├── uninstall.sh # Uninstallation script
├── dock-fix-simple.sh # Lightweight shell alternative
└── README.md
Contributions are welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
MIT License - see LICENSE file.
Made by @croustibat
If this tool helped you, consider giving it a star!