DropletWorkspaceService
Things a droplet can ask the system to do on the user's behalf.
@MainActor protocol DropletWorkspaceService : AnyObject
Methods
copyToPasteboard(_:)
@discardableResult @MainActor func copyToPasteboard(_ text: String) -> Bool
Copies plain text to the pasteboard. Requires clipboard-write.
goBackInSettings()
@discardableResult @MainActor func goBackInSettings() -> Bool
Takes Droppy's Settings one step back, the way the toolbar's Back does, when the page on screen is one of this droplet's own.
For a page that finishes by itself: an editor's Save or Cancel, a picker's pick. A page reached through openSettingsPage(_:title:) or a DropletSettingsPageLink goes back to the page it was reached from, with that page's title in the toolbar again. Needs DroppyKit 1.17.0: declare minAPI 1.17.0. Returns false when the host refused, which it does when the page on screen is not this droplet's.
goBackInSettings()
@discardableResult @MainActor func goBackInSettings() -> Bool
A host older than 1.17.0 cannot step its Settings back for a droplet, and refuses.
open(_:)
@discardableResult @MainActor func open(_ url: URL) -> Bool
Opens a URL in the user's default handler. Returns false when the host refused, which it does for schemes outside http, https, mailto, and file unless the droplet declared them.
openSettings()
@discardableResult @MainActor func openSettings() -> Bool
Opens Droppy's Settings on this droplet's own page, the one your SettingsPaneProviding pane is drawn on.
For the "Set up" button on a widget that has nothing to show until the user configures it. The window comes forward on its own; the shelf is left to close the way it normally does once the pointer leaves it. Needs DroppyKit 1.5.0: declare minAPI 1.5.0. Returns false when the host refused, for example for a droplet without a settings pane.
openSettings()
@discardableResult @MainActor func openSettings() -> Bool
A host that cannot open a droplet's Settings page refuses.
openSettingsPage(_:title:)
@discardableResult @MainActor func openSettingsPage(_ id: String, title: String) -> Bool
Opens Droppy's Settings on one of this droplet's own pages, the ones SettingsPagesProviding builds, with title in the toolbar and Back leading to the droplet's page.
For a "Settings…" command of the droplet's own, so it lands where its Settings live instead of in a window of its own. Needs DroppyKit 1.13.0: declare minAPI 1.13.0. Returns false when the host refused, for example for a droplet that provides no pages.
openSettingsPage(_:title:)
@discardableResult @MainActor func openSettingsPage(_ id: String, title: String) -> Bool
A host older than 1.13.0 has no droplet pages, and refuses.
openShortcuts()
@discardableResult @MainActor func openShortcuts() -> Bool
Opens Droppy's Settings on the Shortcuts page, narrowed to this droplet's section, where every shortcut in Droppy is set.
For the place in a droplet's own settings where a recorder used to be. Needs DroppyKit 1.16.0: declare minAPI 1.16.0. Returns false when the host refused.
openShortcuts()
@discardableResult @MainActor func openShortcuts() -> Bool
A host older than 1.16.0 lists no droplet shortcuts, and refuses.
revealInFinder(_:)
@MainActor func revealInFinder(_ url: URL)
Reveals a file in Finder.