public sealed record MacOSDesktopOptions : IEquatable<MacOSDesktopOptions> macOS application configuration: the Dock menu, Open Recent and an application delegate of the application's own.
Remarks
Other platforms ignore these options.
Constructors
MacOSDesktopOptions
public MacOSDesktopOptions() No documentation.
Properties
DockMenu
public IReadOnlyList<DesktopMenuEntry> DockMenu { get; init; } Gets the items that the application's Dock menu shows above the system's; empty, the default, for none.
Remarks
Items, separators and submenus follow the rules of a context menu; shortcuts are not shown. Choosing an item runs its command through DesktopHost.MenuCommands, as a menu bar item does while no window is key, and an item is enabled when its DesktopMenuItem.IsEnabled is true and that target's IDesktopMenuCommandTarget.CanExecute answers true as the menu opens.
The menu exists while DesktopEventLoop runs. With several hosts, the first host started with a Dock menu supplies it.
ForwardingApplicationDelegate
public nint ForwardingApplicationDelegate { get; init; } Gets an Objective-C object that implements NSApplicationDelegate methods of the application's own, or 0, the default, for none.
Remarks
DesktopEventLoop sets Runic's own application delegate before the application's code runs; an application that sets NSApp.delegate itself replaces it and loses quit handling, reopen, the Dock menu, open requests and universal links. Runic's delegate forwards every message it does not handle to this object, such as applicationDidFinishLaunching:, applicationDidBecomeActive: or applicationShouldTerminateAfterLastWindowClosed:, and also applicationWillFinishLaunching: after its own handling. It asks this object when Runic does not answer: a Dock menu while MacOSDesktopOptions.DockMenu is empty, a continued user activity that is not one of the application's universal links, and reopen, whose answer it uses after raising DesktopHost.ReopenRequested. applicationShouldTerminate: is Runic's: use DesktopHostOptions.ConfirmQuitAsync. The open-documents and get-URL Apple events go to the open requests of Runic.Platform.MacOS, not to application:openURLs:.
Runic retains the object for the process lifetime. The first host started with one supplies it.
OpenRecentMenu
public bool OpenRecentMenu { get; init; } Gets whether the standard File menu starts with Open Recent, the submenu of the documents noted with DesktopHost.AddRecentDocumentAsync; false, the default, for none.
Remarks
Each time the submenu opens, Runic lists the application's recent documents (NSDocumentController.recentDocumentURLs, the list the Dock menu also shows), most recent first, with their display names and file icons, above a Clear Menu item that empties the list and is disabled while it is empty. Choosing a document delivers its path as an open request (IDesktopOpenRequests.Opened of Runic.Platform.MacOS with DesktopOpenOptions.IncludeFiles), as choosing it in the Dock or opening it in the Finder does; the open requests keep it until they are created. Declared items of a DesktopMenuRole.File menu, such as Open…, come before it.
The menu uses public AppKit API only, so the App Sandbox grants no access to a document chosen in it: a sandboxed application keeps a bookmark of each document (A1: ISaveFileLease.CreateBookmarkAsync), finds the one for the delivered path and reopens the document with IDesktopFileBookmarks.OpenDocumentAsync.
Runic adds Open Recent to the main menu that it completes, as the other standard menus, not to a main menu of the application's own. DesktopStandardMenuTitles.OpenRecent and DesktopStandardMenuTitles.ClearMenu give the titles. The first host started with this option adds it; the menu stays for the process.