fix(tray): stop the Windows tray launching the CLI instead of the GUI - #460
fix(tray): stop the Windows tray launching the CLI instead of the GUI#460Stanley5249 wants to merge 2 commits into
Conversation
The CLI binary `openlogi.exe` case-insensitively equals the GUI's
`OpenLogi.exe`, so in a cargo target dir — the only layout holding both — the
tray's Show/Quit mistook a transient CLI run for the GUI, and `spawn_gui`
launched the CLI (`dir.join("OpenLogi.exe").exists()` resolves to it on the
case-insensitive filesystem) instead of the window.
Match `OpenLogi.exe` case-sensitively so the lowercase CLI no longer counts as
the GUI, and probe the unambiguous `openlogi-gui.exe` first when spawning.
Greptile SummaryThis PR fixes a Windows-only bug where the tray's "Show Main Window" action could launch the CLI binary (
Confidence Score: 5/5Safe to merge; the change is narrowly scoped to two helper functions in The fix correctly addresses both the process-detection path ( Files Needing Attention: No files require special attention; the only changed file,
|
| Filename | Overview |
|---|---|
| crates/openlogi-agent/src/tray_windows.rs | Switches OpenLogi.exe process-name matching from case-insensitive to case-sensitive to prevent the CLI (openlogi.exe) from being mistaken for the GUI; reverses binary probe order in spawn_gui so the unambiguous openlogi-gui.exe is checked before OpenLogi.exe; adds a unit test covering the key discriminant. |
Reviews (2): Last reviewed commit: "test(tray): pin that the Windows CLI bin..." | Re-trigger Greptile
The GUI/CLI discrimination is one string comparison, and its failure mode is silent: Show would spawn a duplicate GUI that immediately exits on the singleton lock, so nothing visible happens. Extract the predicate out of `gui_pids`'s filter and assert all three names, so a regression fails a local `cargo test` on Windows instead of only showing up as a dead tray menu. CI does not run it: the module is cfg'd to Windows and the only Windows job is clippy, which compiles the test but never executes it. Also record why the two names are matched differently — `OpenLogi.exe` exactly (the CLI `openlogi.exe` collides with it case-insensitively) and `openlogi-gui.exe` case-insensitively (nothing else shares that name).
Summary
On Windows the tray's "Show Main Window" launched the CLI instead of the GUI, and
Show/Quit could report
GUI process is running but no window was found to focus.Root cause:
tray_windows.rsidentifies the GUI by filename —OpenLogi.exe(installed)or
openlogi-gui.exe(dev). The CLI binary isopenlogi.exe, and"openlogi.exe".eq_ignore_ascii_case("OpenLogi.exe")is true. They share a name onthe case-insensitive filesystem, so in a cargo target dir — the only layout that holds
both —
gui_pids()took a transient CLI run for the GUI, andspawn_gui()'sdir.join("OpenLogi.exe").exists()resolved to the CLI and launched it.The installed layout ships only
OpenLogi.exe+openlogi-agent.exe(noopenlogi.exe),so this only bites dev/portable layouts — but it's a real filename-collision bug.
Changes
OpenLogi.execase-sensitively (process names keeptheir on-disk case, so the lowercase CLI
openlogi.exeno longer counts as the GUI);probe the unambiguous
openlogi-gui.exefirst when spawning, so.exists()doesn'tresolve
OpenLogi.exeto the CLI on the case-insensitive filesystem.Testing
cargo clippy -p openlogi-agent --all-targets -- -D warnings— clean.Windows-only tray behaviour, not runtime-tested on hardware yet (verify by rebuilding
the agent and clicking the tray: it should open the GUI window, not print a device list).
Fixes the wrong-binary launch reported on Windows dev builds.