Skip to content
Discussion options

You must be logged in to vote

Copy pasting the answer from stackoverflow for visibility:

Tauri doesn't seem to support setting the activation policy after startup, but you can set it yourself at runtime (see the comments and edits to this answer) by calling the AppKit API using the cocoa crate:

use cocoa::appkit::{NSApp, NSApplication, NSApplicationActivationPolicy::*};

unsafe {
    let app = NSApp();
    app.setActivationPolicy_(NSApplicationActivationPolicyAccessory);
}

Inserting this immediately after the call to api.prevent_exit() causes the window to close and the dock icon to disappear, but the program continues running.

It's worth noting that Tauri doesn't expect you to do this, so it may cause other unex…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@billywatkins
Comment options

@FabianLars
Comment options

@billywatkins
Comment options

@billywatkins
Comment options

@billywatkins
Comment options

Answer selected by billywatkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants