Skip to content

fix(tray): stop the Windows tray launching the CLI instead of the GUI - #460

Open
Stanley5249 wants to merge 2 commits into
AprilNEA:masterfrom
Stanley5249:fix/tray-launches-cli
Open

fix(tray): stop the Windows tray launching the CLI instead of the GUI#460
Stanley5249 wants to merge 2 commits into
AprilNEA:masterfrom
Stanley5249:fix/tray-launches-cli

Conversation

@Stanley5249

Copy link
Copy Markdown

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.rs identifies the GUI by filename — OpenLogi.exe (installed)
or openlogi-gui.exe (dev). The CLI binary is openlogi.exe, and
"openlogi.exe".eq_ignore_ascii_case("OpenLogi.exe") is true. They share a name on
the 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, and spawn_gui()'s
dir.join("OpenLogi.exe").exists() resolved to the CLI and launched it.

The installed layout ships only OpenLogi.exe + openlogi-agent.exe (no openlogi.exe),
so this only bites dev/portable layouts — but it's a real filename-collision bug.

Changes

  • tray: match the product GUI OpenLogi.exe case-sensitively (process names keep
    their on-disk case, so the lowercase CLI openlogi.exe no longer counts as the GUI);
    probe the unambiguous openlogi-gui.exe first when spawning, so .exists() doesn't
    resolve OpenLogi.exe to 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.

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-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a Windows-only bug where the tray's "Show Main Window" action could launch the CLI binary (openlogi.exe) instead of the GUI (OpenLogi.exe) in dev/portable layouts. The root cause was that eq_ignore_ascii_case treated openlogi.exe and OpenLogi.exe as identical on a case-insensitive filesystem.

  • is_gui_process_name now matches OpenLogi.exe with == (case-sensitive) so the lowercase CLI is excluded, while openlogi-gui.exe remains case-insensitive (no ambiguity risk there).
  • spawn_gui now probes openlogi-gui.exe before OpenLogi.exe, so Path::exists() on the case-insensitive filesystem can't resolve OpenLogi.exe to the CLI; the installed layout (no openlogi-gui.exe) falls through correctly.
  • A unit test is added for is_gui_process_name covering both GUI names and the CLI negative case.

Confidence Score: 5/5

Safe to merge; the change is narrowly scoped to two helper functions in tray_windows.rs and is well-commented with a matching unit test.

The fix correctly addresses both the process-detection path (gui_pids via is_gui_process_name) and the binary-launch path (spawn_gui probe order). The case-sensitive == comparison for OpenLogi.exe is the right discriminant because Windows sysinfo reports process names with on-disk casing, and the installed layout ships only OpenLogi.exe (no lowercase collision exists there). The reversed probe order in spawn_gui is safe for both layouts: dev finds openlogi-gui.exe first; installed falls through to OpenLogi.exe because no file named openlogi-gui.exe exists to match. No pre-existing behaviour for correct installations is affected.

Files Needing Attention: No files require special attention; the only changed file, tray_windows.rs, has clear reasoning in its comments and a matching test.

Important Files Changed

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant