Windows-like Minimize toggle on Dock icons

The script aims to replicate a Windows-like behavior for clicking on dock icons in macOS.
When one (1) app Window:

  1. When an app is open but minimized, clicking its dock icon will unminimize and bring the app window to the front (native in both macOS and Windows).
  2. When an app is open, frontmost and not minimized, clicking its dock icon will minimize the app window (native only in Windows).
  3. When an app is open but not frontmost, clicking it's dock icon will bring the latest app window to front (native in both macOS and Windows).
  4. When an app is not open, clicking its dock icon will launch the app (native in both macOS and Windows).

When more than one (1) app Window:

  1. For apps with multiple windows open, clicking the dock icon bring last window to the front.

This behavior is not native to macOS. By default on Mac, clicking a dock icon of a minimized app does not unminimize it, it's unhidden. The script aims to make the dock behavior more similar to the Windows taskbar, where a single click toggles the window state with the Minimize action.

Presets can be found here BetterTouchTool Preset Sharing Platform

Props to yw4z's Enhanced Dock for macOS for inspiration.

2024-10-03 at 09.38.07