Comments (9)
+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.
from single-instance.
I dont fully understand what you said brings the window to the foreground
, Can you explain more detail about what you are proposing?
from single-instance.
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)
from single-instance.
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.
from single-instance.
One solution I can imagine is use unix domain socket inform another instance.
from single-instance.
The same potentially with Windows named pipes, unless there is another way to get the window handle.
from single-instance.
I would very much love to see this feature as well. Why was it closed?
Thanks!
from single-instance.
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.
from single-instance.
+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.
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()
}
from single-instance.
Related Issues (8)
- got "no `__errno_location` in the root" HOT 4
- Unresolved import `self::inner` HOT 1
- macOS not listed as supported platform on docs.rs HOT 1
- Consider using an abstract Unix domain socket on Linux HOT 3
- SingleInstance is not Send on Windows platform HOT 1
- False positive determining if application is already running HOT 1
- nix 0.19.1 on which this crate depends has a vulnerability and should be updated to the newer version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from single-instance.