Fixed an issue where multiple instances could run at the same time
This commit is contained in:
parent
2188800388
commit
8da0ec5ff7
@ -12,7 +12,7 @@ use std::{
|
||||
use abi_stable::std_types::{ROption, RVec};
|
||||
use anyrun_interface::{HandleResult, Match, PluginInfo, PluginRef, PollResult};
|
||||
use clap::Parser;
|
||||
use gtk::{gdk, gdk_pixbuf, glib, prelude::*};
|
||||
use gtk::{gdk, gdk_pixbuf, gio, glib, prelude::*};
|
||||
use nix::unistd;
|
||||
use serde::Deserialize;
|
||||
use wl_clipboard_rs::copy;
|
||||
@ -138,6 +138,14 @@ pub const DEFAULT_CONFIG_DIR: &str = "/etc/anyrun";
|
||||
fn main() {
|
||||
let app = gtk::Application::new(Some("com.kirottu.anyrun"), Default::default());
|
||||
|
||||
// Register here so we know if the instance is the primary or a remote
|
||||
app.register(None::<&gio::Cancellable>).unwrap();
|
||||
|
||||
// If another instance is running, quit
|
||||
if app.is_remote() {
|
||||
return;
|
||||
}
|
||||
|
||||
let args = Args::parse();
|
||||
|
||||
// Figure out the config dir
|
||||
|
Loading…
x
Reference in New Issue
Block a user