Skip to content

croustibat/DockManager

Repository files navigation

DockManager

A lightweight macOS menu bar app that automatically keeps your Dock on your primary external display.

The Problem

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.

The Solution

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

Installation

Manual Installation

  1. Clone the repository:

    git clone https://github.com/croustibat/DockManager.git
    cd DockManager
  2. Compile the app:

    swiftc -o DockManager DockManager.swift -framework Cocoa
  3. Run it:

    ./DockManager
  4. (Optional) Install as a LaunchAgent to start automatically:

    ./install.sh

Usage

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

How It Works

  1. On launch: Saves your current Dock position as your "preferred" position
  2. When external display connects: Detects if your preferred edge is blocked by another screen and moves the Dock to a free edge
  3. When external display disconnects: Restores your preferred Dock position

Requirements

  • macOS 10.15 (Catalina) or later
  • Xcode Command Line Tools (for compilation)
xcode-select --install

Uninstall

./uninstall.sh

Or manually:

launchctl unload ~/Library/LaunchAgents/com.baptiste.dockmanager.plist
rm ~/Library/LaunchAgents/com.baptiste.dockmanager.plist
rm /usr/local/bin/DockManager

File Structure

DockManager/
├── 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

Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest features
  • Submit pull requests

License

MIT License - see LICENSE file.

Author

Made by @croustibat


If this tool helped you, consider giving it a star!

About

A macOS menu bar app that keeps your Dock on your primary display

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •