Desktop: Add support for opening files through the already-running instance via a local socket (#4123)

* Desktop: Forward file-open args from a second launch to the running instance

Also adds socket infrastructure that can be used in the future to allow dispatching actions from another process

* Use socket instead of ipc terminologie

* Fix

* Fix

* Better pipe name on windows
This commit is contained in:
Timon
2026-05-09 18:11:44 +00:00
committed by GitHub
parent a28b9437aa
commit 98daa75c26
10 changed files with 260 additions and 83 deletions
+10 -1
View File
@@ -19,6 +19,7 @@ mod gpu_context;
mod persist;
mod preferences;
mod render;
mod socket;
mod window;
pub(crate) mod consts;
@@ -58,7 +59,13 @@ pub fn start() {
}
Err(_) => {
tracing::error!("Another instance is already running, Exiting.");
std::process::exit(1);
if !cli.files.is_empty()
&& let Err(error) = socket::send(socket::Message::OpenFiles(cli.files))
{
tracing::error!("Failed to send socket message to running instance: {}", error);
std::process::exit(1);
}
return;
}
};
@@ -78,6 +85,8 @@ pub fn start() {
let (app_event_sender, app_event_receiver) = std::sync::mpsc::channel();
let app_event_scheduler = event_loop.create_app_event_scheduler(app_event_sender);
let _socket_handle = socket::start(app_event_scheduler.clone());
let (cef_view_info_sender, cef_view_info_receiver) = std::sync::mpsc::channel();
if cli.disable_ui_acceleration {