Skip to content

feat(macos): expose set_activation_policy #2258

@srsholmes

Description

@srsholmes

Is your feature request related to a problem? Please describe.

I would like to make a launcher / spotlight / alfred type application. Currently tauri apps have a menu and a dock icon, which isn't really compatible with this use case.

Describe the solution you'd like

Ideally, we would have the ability to create NSPanel type windows, as described here. This would allow the apps to hide and show and not steal focus when they come to the foreground.

In conjuction with the hide window functionality, this would also solve https://github.com/tauri-apps/tauri/issues/2063

However, after doing some exploration I couldn't find any reference to NSPanel in the cocoa bindings that wry depends on, so this might not be possible without multiple PR's and potentially a lot of work.

Describe alternatives you've considered

tao has the ability to create applications without a dock menu item and menu bar, which can be seen in this example here.

As wry exposes taos functionality, this should be possible in tauri, but it is not exposed in the public api.

I think if this were to be expose by the public tauri api we could create similar apps to an NSPanel window, when used in combination with a sidecar application to manage window focus.

Additional context

Some more info on NSPanel:
https://developer.apple.com/documentation/appkit/nspanel
https://www.markusbodner.com/til/2021/02/08/create-a-spotlight/alfred-like-window-on-macos-with-swiftui/
https://stackoverflow.com/questions/54054473/create-spotlight-like-window-in-swift-4

What an NSPanel window would look like:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions