fix: focus main window on launching second instance

This commit is contained in:
Vladimir Borisov 2025-01-13 16:29:51 +02:00
parent aec176a238
commit 8ecdb1264b
No known key found for this signature in database
GPG key ID: F9A584BE4FCB6603

View file

@ -174,11 +174,13 @@ impl MainWindow {
}); // thread
if let Ok(mut listener) = PipeServer::bind(socket_path) {
let focus_sender = self.focus_notice.sender();
thread::spawn(move || loop {
if let Ok(mut stream) = listener.accept() {
let mut buf = vec![];
stream.read_to_end(&mut buf).ok();
if let Ok(s) = str::from_utf8(&buf) {
focus_sender.notice();
// ['open-media', url]
web_tx_arg.send(RPCResponse::open_media(s.to_string())).ok();
println!("{}", s);