Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

Merge PR #1663: Open: opening an already-open document focuses its tab (#1620)

aionggf800969a403c
diff --cc crates/ui-egui/src/lib.rs
index e49c45b5b,73147909f..287363c2d
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@@ -3137,13 -3092,9 +3174,15 @@@ impl eframe::App for PdfCraftApp
for e in os_events {
match e {
#[cfg(not(target_arch = "wasm32"))]
- OsEvent::Open(paths) => paths.iter().for_each(|p| {
- self.open_path(p);
- }),
+ OsEvent::Open(paths) => {
- paths.iter().for_each(|p| self.open_path(p));
++ paths.iter().for_each(|p| {
++ self.open_path(p);
++ });
+ // Files handed to the running app (Finder, or another launch): bring its
+ // window to the front, also when minimized or full screen on another Space.
+ ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(false));
+ ctx.send_viewport_cmd(egui::ViewportCommand::Focus);
+ }
#[cfg(target_arch = "wasm32")]
OsEvent::Open(_) => {}
// Like closing the window: `guard_quit` asks about unsaved changes.