#561

[macOS] Double-click on a drag region doesn't zoom/fill the window

Openrsolmanoopened 1mo ago

Summary

On macOS, double-clicking a drag region (-webkit-app-region: drag) does nothing. In a native window, double-clicking the title bar does what the user picked in System Settings → Desktop & Dock → "Double-click a window's title bar to": Fill, Zoom, Minimize, or Do Nothing.

With titleBarStyle: "hiddenInset", the webview covers the native title bar, so the app's custom title bar is the only place the user can double-click. Right now it can only be used for dragging.

The Windows version of this was fixed in #395.

Environment

  • Electrobun v2.0.1 (same code on main and v2.0.2-beta.35)
  • macOS 26.6.2, Apple Silicon
  • Window created with titleBarStyle: "hiddenInset" and a custom title bar marked -webkit-app-region: drag

Steps to reproduce

  1. Create a window with titleBarStyle: "hiddenInset".
  2. Add a header with -webkit-app-region: drag.
  3. Double-click the header.

Expected: the window does what the macOS setting says (for example, it fills the screen). Actual: nothing happens. Dragging works.

Cause

preload/dragRegions.ts only listens for mousedown / mouseup and sends startWindowMove / stopWindowMove. The native startWindowMove only moves the window. Nothing handles a double-click.

Suggested fix

Handle a double-click on a drag region the way Chromium does (components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm). Read AppleActionOnDoubleClick from NSUserDefaults:

  • "Fill" → _zoomFill: (if available)
  • missing or "Maximize" → performZoom:
  • "Minimize" → performMiniaturize:
  • "None" or anything else → do nothing

Workaround

We work around it in our app: our preload listens for dblclick on drag regions and sends a message to the main process. The main process reads the setting and calls maximize() / unmaximize() / minimize(). Fill falls back to zoom there, because _zoomFill: can't be reached from the JS API. See https://github.com/JetBrains/thinkrail/pull/562.

Activity

0

No activity yet.