Download packages/tauri-plugins/plugins/single-instance/src/lib.rs from echodict/readest: direct link, hf CLI and curl.
- Browser
- Download file 1.82 kB
-
https://huggingface.co/datasets/echodict/readest/resolve/main/packages/tauri-plugins/plugins/single-instance/src/lib.rs
- Command line
-
hf download hf://datasets/echodict/readest/packages/tauri-plugins/plugins/single-instance/src/lib.rs
-
curl -L -o lib.rs https://huggingface.co/datasets/echodict/readest/resolve/main/packages/tauri-plugins/plugins/single-instance/src/lib.rs
1.82 kB
| // Copyright 2019-2023 Tauri Programme within The Commons Conservancy | |
| // SPDX-License-Identifier: Apache-2.0 | |
| // SPDX-License-Identifier: MIT | |
| //! Ensure a single instance of your tauri app is running. | |
| use std::sync::LazyLock; | |
| use tauri::async_runtime::Mutex; | |
| use tauri::{plugin::TauriPlugin, AppHandle, Manager, Runtime}; | |
| mod platform_impl; | |
| mod platform_impl; | |
| mod platform_impl; | |
| mod semver_compat; | |
| pub(crate) type SingleInstanceCallback<R> = | |
| dyn FnMut(&AppHandle<R>, Vec<String>, String) + Send + Sync + 'static; | |
| pub fn init<R: Runtime, F: FnMut(&AppHandle<R>, Vec<String>, String) + Send + Sync + 'static>( | |
| mut f: F, | |
| ) -> TauriPlugin<R> { | |
| platform_impl::init(Box::new(move |app, args, cwd| { | |
| if let Some(deep_link) = app.try_state::<tauri_plugin_deep_link::DeepLink<R>>() { | |
| deep_link.handle_cli_arguments(args.iter()); | |
| } | |
| f(app, args, cwd) | |
| })) | |
| } | |
| pub fn destroy<R: Runtime, M: Manager<R>>(manager: &M) { | |
| platform_impl::destroy(manager) | |
| } | |
| static OVERRIDE_DBUS_ID: LazyLock<Mutex<Option<String>>> = LazyLock::new(|| Mutex::new(None)); | |
| pub async fn set_dbus_id(dbus_id: String) { | |
| let mut id = OVERRIDE_DBUS_ID.lock().await; | |
| *id = Some(dbus_id); | |
| } | |