mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-05-09 23:58:05 +03:00
macos: present the window on the post-grant relaunch
After the user clicks Relaunch on the warning row, the new instance started hidden in the menu bar — no visible confirmation that the relaunch actually worked. Present the window on that specific launch so the user sees the app come up healthy. Mechanism: relaunch_bundle() sets LAN_MOUSE_RELAUNCHED=1 via `open --env` when spawning the new instance. build_ui reads the env var and calls window.present() only when it's set. Normal fresh launches (from Finder / Dock / Launchpad / any other Launch Services path) continue to start hidden in the menu bar. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
Ferdinand Schober
parent
94e9301e9c
commit
99344a3104
@@ -144,7 +144,11 @@ pub fn relaunch_bundle() {
|
||||
|
||||
// Trailing `&` backgrounds the sleep+open so our shell call returns
|
||||
// immediately; the spawned shell is adopted by launchd once we exit.
|
||||
let cmd = format!("(sleep 1 && open {bundle:?}) &");
|
||||
// `--env LAN_MOUSE_RELAUNCHED=1` sets an env var on the new process
|
||||
// so `build_ui` can present the main window on this specific launch
|
||||
// (confirming to the user that the grant + relaunch worked) while
|
||||
// still starting hidden in the menu bar on normal fresh launches.
|
||||
let cmd = format!("(sleep 1 && open --env LAN_MOUSE_RELAUNCHED=1 {bundle:?}) &");
|
||||
let _ = Command::new("sh").arg("-c").arg(cmd).spawn();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user