-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Activate Instance #10
Comments
I dont fully understand what you said |
A function that if another instance exists, and if that Instance has a GUI, to bring the GUI to the foreground (in case it is minimized or hidden) |
Very interesting idea. I will do some research on this, although I probably would not add this kind of complex feature to this simple crate. |
One solution I can imagine is use unix domain socket inform another instance. |
The same potentially with Windows named pipes, unless there is another way to get the window handle. |
I would very much love to see this feature as well. Why was it closed? Thanks! |
+1! I'm looking for single-instance in my Tauri app. When a user tries to open a new instance, it should bring focus to the existing application. However, seeing this is a low-level utility (you wouldn't even need a GUI app at all) it wouldn't make sense to try to foreground an application from this crate. However, what would work is if the existing instance got a notification that another instance has been requested, perhaps as a receiving channel + canceler API. This would be sufficient to pipe through the request and do the appropriate thing. Note that this would have tremendous value even if it wasn't supported on all platforms. For instance, MacOS already has deduplication so it's never a problem in practice (afaik). Windows is certainly the most useful one, probably followed by Linux. Please consider reopening this. |
A potential workaround until this feature is added: what is really needed is a "platform independent IPC". It looks like there is a crate that does this: interprocess. My plan is to use this crate plus that one (haven't tried yet, but seems like it should work). At that point, the first process could take any action needed in a GUI independent manner once notified including restoring a GUI window, etc. |
Hi there, i wonder have you already tried using this crate in your app? I'm trying add this to my tauri app, it works well in pure rust, but seems to be not working in tauri. I tried like this #[tauri::command]
fn check_instance() -> bool {
let instance = SingleInstance::new("tauri-app").unwrap();
println!("check instance whether single {}", instance.is_single());
instance.is_single()
} |
Since both Linux and Windows now use something akin of domains, it makes me believe it should be somewhat possible to implement a function that brings the window to the foreground.
The text was updated successfully, but these errors were encountered: