DroppyPanelActivation

Droppy made the active app while a droplet's own floating panel is up, and the foreground handed back when it closes (DroppyKit 1.15.0).

@MainActor final class DroppyPanelActivation

Droppy runs as a background app, and AppKit delivers mouse moves to a non-activating panel of an app that is not active only now and then: a launcher's rows light up late, or not at all, as the pointer sweeps them, and snap into place the moment Droppy's Settings window happens to be the active one. Begin one right after ordering the panel front, finish it right before ordering the panel out:

panel.makeKeyAndOrderFront(nil)
activation = DroppyPanelActivation.begin(for: panel, returningTo: previousApp)
// ...
activation?.finish()
panel.orderOut(nil)

It is the session Droppy's own launcher used: the panel becomes key and main, Droppy becomes active, any ordinary Droppy window that was behind another app stays behind it, and finish() yields the foreground back to returningTo unless the user moved into another Droppy window meanwhile. nil outside Droppy (the harness, a host older than 1.15.0).

Initializers

init(finish:)

@MainActor init(finish: @escaping @MainActor () -> Void)

Creates one. Constructed by hosts.

Type methods

begin(for:returningTo:)

@MainActor static func begin(for panel: NSWindow, returningTo application: NSRunningApplication?) -> DroppyPanelActivation?

Makes Droppy the active app for panel, handing the foreground back to application (the app the panel was summoned over) on finish().

Methods

finish()

@MainActor func finish()

Hands the foreground back. Once; later calls do nothing.