pub struct Builder<R: Runtime> { /* private fields */ }Expand description
Builds the single-instance plugin.
Created with Builder::new and consumed by Builder::build.
Implementations§
Source§impl<R: Runtime> Builder<R>
impl<R: Runtime> Builder<R>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new builder with a no-op callback (or, when the deep-link feature is enabled,
a callback that only forwards the arguments to the deep-link plugin) and no custom D-Bus
ID. Use Builder::callback and Builder::dbus_id to configure it, then
Builder::build to create the plugin.
Sourcepub fn callback<F: FnMut(&AppHandle<R>, Vec<String>, String) + Send + Sync + 'static>(
self,
f: F,
) -> Self
pub fn callback<F: FnMut(&AppHandle<R>, Vec<String>, String) + Send + Sync + 'static>( self, f: F, ) -> Self
Function to call when a secondary instance was opened by the user and killed by the plugin.
If the deep-link feature is enabled, the plugin triggers the deep-link plugin before executing the callback.
Sourcepub fn dbus_id(self, dbus_id: impl Into<String>) -> Self
pub fn dbus_id(self, dbus_id: impl Into<String>) -> Self
Set a custom D-Bus ID, used on Linux. The plugin will append a .SingleInstance subname.
For example com.mycompany.myapp will result in the plugin registering its D-Bus service on com.mycompany.myapp.SingleInstance.
Usually you want the same base ID across all components in your app.
Defaults to the app’s bundle identifier set in tauri.conf.json.
Sourcepub fn build(self) -> TauriPlugin<R>
pub fn build(self) -> TauriPlugin<R>
Builds the single-instance TauriPlugin.
Register it first among your app’s plugins, since the plugins run in the order they were added and a second instance must be detected before the rest of your setup runs.