Skip to main content

Module mac_shell

Module mac_shell 

Source
Expand description

Fixes and additions to the windowing library’s macOS application shell (winit 0.30):

  • guard_appearance: the window delegate observes effectiveAppearance and casts the old and new values to NSAppearance unchecked. While the screen is being captured (ScreenCaptureKit, ReplayKit) AppKit can report a nil appearance, and the cast ends the process. The guard checks the values first and drops such a change.
  • listen_reopen: clicking the Dock icon (or opening the app again in Finder) asks the application delegate applicationShouldHandleReopen:hasVisibleWindows:, which winit doesn’t answer, so a hidden window stays hidden. The method is added and reported, so the app shows and focuses its window.
  • quiet_requested: <PREFIX>_QUIET=1 asks for a launch that doesn’t take the focus, for agents and scripts that rebuild and relaunch the app in a loop. The app then opens its window without activating (an ashlar app does this itself).

The first two return NativeError::Unsupported off macOS.

Structs§

Reopen
The Dock (or Finder) asked to reopen the app.

Functions§

guard_appearance
Guard the window delegate’s appearance observer (see the module docs). Call it on the main thread once a window exists (the delegate class is registered with the first window). Calling again does nothing.
listen_reopen
Report Dock reopen requests: each one is queued on the returned receiver and waker is called. Main thread, once the event loop runs (winit’s delegate must exist). Calling again moves the reports to the new receiver.
quiet_requested
<env_prefix>_QUIET is set to something other than empty, 0, false, no or off.