Skip to content

Launch a browser whose desktop entry starts with env - #17134

Open
sundarshahi wants to merge 6 commits into
omacom:quattrofrom
sundarshahi:launch-browser-env-exec
Open

sundarshahi wants to merge 6 commits into
omacom:quattrofrom
sundarshahi:launch-browser-env-exec

Conversation

@sundarshahi

@sundarshahi sundarshahi commented Oct 31, 2026 •

Copy link
Copy Markdown

Fixes #17074

A default browser whose desktop entry starts with an env prefix, as in Exec=env DRI_PRIME=0 chromium %U, cannot open links. omarchy-launch-browser takes the first word of Exec= as the browser, so every link open runs env <url>, which fails, and its output goes to null, so nothing visible happens. omarchy-launch-webapp reads Exec= the same way and runs env --app=<url>. omarchy-cmd-default-browser checks the same first word to decide that a browser is installed, so env passes for any such entry, including one whose browser has since been removed.

All three now skip a leading env or /usr/bin/env and its VAR=VALUE words to find the browser. The launchers keep those variables, so the browser starts as env DRI_PRIME=0 chromium <url>, as it does from the desktop entry. The private-flag probe and window focus use the browser itself. The handoff to a running Chromium-based browser runs with the entry's variables, except PATH, which it needs to find its own helpers, so an entry that points its browser at another profile (CHROME_CONFIG_HOME=, XDG_CONFIG_HOME=) is refused there and launched, instead of having its URL handed to the default profile. The browser's own flags after the command are still dropped, as before; this only changes the prefix.

The three scripts read Exec= through one shared helper, bin/omarchy-cmd-browser-exec, which splits it the way the Desktop Entry spec quotes it, without shell evaluation, so Exec=env "CHROME_CONFIG_HOME=/home/alex/Browser Profiles" chromium %U keeps its value whole. omarchy-cmd-default-browser looks the browser up on the PATH the prefix sets, as env would launch it.

launch-browser-test.sh covers a link and a web app opened through an env-prefixed entry, and default-browser-lookup-test.sh covers an env-prefixed entry for a removed browser. On Linux those two files, browser-handoff-test.sh, browser-link-handoff-test.sh, default-apps-test.sh and launch-openclaw-test.sh pass. Reverting each of the three scripts to quattro fails its new check. This applies cleanly with #16998, which changes the private-flag probe in the same file.

With the follow-up commit, launch-browser-test.sh and default-browser-lookup-test.sh also cover a quoted value with spaces and a browser found only on the prefix's PATH; both files pass on Linux (bash 5.2), and each new check fails on the first commit. test/cli gives the same results with and without the follow-up.

The third commit hands omarchy-cmd-browser-handoff the executable the entry's PATH selects, so a wrapper there is launched instead of its URL going to a same-named browser on the session's PATH. launch-browser-test.sh covers it; both files pass on Linux (bash 5.2), and the new check fails on the second commit.

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no new actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Adds shared parsing for browser desktop entries that start with env.

  • Browser entries with an env prefix now open links and web apps.

The earlier quoted-value, browser-lookup, and wrapper-handoff findings are fixed. sundarshahi intentionally deferred the private-flag probe change to #16998 to avoid a conflict; Greptile accepted that reason and withdrew the finding.

The previous-review merge bases differ, so this review covered the full PR range.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Default browser desktop entry] --> B[Shared Exec parser]
  B --> C[Browser and entry variables]
  C --> D[Check selected executable for handoff]
  D -->|Browser accepts URL| E[Use running browser]
  D -->|Handoff declines| F[Launch browser with entry variables]
Loading

Reviews (7) · Last reviewed commit: "Merge quattro: pass the exact --private ..." · Reviewed by Greptile

Comment thread bin/omarchy-cmd-default-browser Resolved
Comment thread bin/omarchy-cmd-default-browser Resolved
Comment thread bin/omarchy-cmd-browser-exec Resolved
Comment thread bin/omarchy-launch-browser Resolved
An entry like Exec=env DRI_PRIME=0 chromium %U set the browser command to env,
so every link open ran `env <url>` and silently did nothing, web apps ran
`env --app=<url>`, and the default browser lookup counted env as an installed
browser. Skip the env prefix to find the browser, and keep its variables for
the launch and the handoff to a running browser.

Fixes omacom#17074
The handoff ran without the entry's PATH, so it looked up a same-named
browser on the session's PATH and could give the URL to that one while a
wrapper the entry points at was bypassed. Resolve the executable on the
entry's PATH and hand that path to omarchy-cmd-browser-handoff.
@sundarshahi
sundarshahi force-pushed the launch-browser-env-exec branch from 5c23ec0 to f91b44f Compare November 12, 2026 16:31
@omarchybot omarchybot added the bug Something isn't working label Nov 18, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed the shared parser, default-browser resolver, both launchers, handoff and regression cases at f91b44f, and compared #11728, #12533, #13240/#13241 and #15077. This was a source comparison; no worker tests ran in this session.

The older #12533 also fixes env-wrapped launches and preserves the rest of the Exec command. I queued this PR’s shared-parser pattern, installed-browser check, entry-PATH lookup and resolver regression cases for integration into #12533, with @sundarshahi credited when those changes are made. The fold needs to retain that PR’s wrapper handling, including accepting Flatpak entries by their wrapper rather than looking up an app ID as a host executable.

GPT-6 High in Codex reviewed this item. Opus 5.5 High favored continuing in #12533; muse-wonder via pi, thinking high initially favored this narrower PR because it also fixes the resolver. Both agreed in the supplementary comparison that #15077 does not displace #12533 and that handing these improvements to it is appropriate. Independence is not guaranteed. This PR remains open, waiting on the maintainer’s choice among the competing fixes.

omarchybot added a commit to paulogeyer/omarchy that referenced this pull request Nov 18, 2026
Resolve browser availability from the same parsed argv used by the launchers, honoring PATH assignments while retaining wrapper checks for Flatpak and env options. This folds omacom#17134's resolver fix and shared-helper pattern into omacom#12533 without discarding desktop arguments. Stop the assignment scan at env options, including --split-string=, so they retain their previous availability behavior.

Co-Authored-By: sundarshahi <shahithakurisundar@gmail.com>
Co-Authored-By: GPT-6 High <noreply@openai.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
…-exec

# Conflicts:
#	bin/omarchy-launch-browser
@omarchybot

Copy link
Copy Markdown
Collaborator

I read the change at 31ddc1c, its merge resolution, the browser resolver and both launchers, the review threads, and #17074. The merge resolution keeps the shared parser together with quattro’s StartupWMClass lookup. This was a source review; no worker tests ran.

GPT-6 in Codex (reasoning effort not exposed) performed this review. I classify the change as a bug fix, but the configured classification model, deepseek-v4p1-flash, returned no usable class for this head. No second opinion reviewed this head in this session; the primary reviewer, Opus 5.5 High, also failed its health check. Classification remains unsettled, so verification is paused pending classification. The earlier comparison with #12533 remains unresolved; this session made no new choice between the competing fixes.

@omarchybot omarchybot added bug Something isn't working and removed bug Something isn't working labels Nov 20, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

The bug classification is now agreed at 31ddc1c. I compared the current parser, resolver, launchers and review threads with #12533, #13240/#13241 and #15077, and read #17074. This was source review; no worker tests ran because the competing-fix comparison leaves #12533 as the branch to pursue.

#12533 has incorporated the shared-parser pattern and resolver checks in 8f78699, crediting @sundarshahi, while keeping the entry’s browser arguments. The remaining difference is that this PR allows env-prefixed entries to reach direct browser handoff; I handed that difference to #12533’s session to assess while preserving wrapper and profile handling. These are different implementations, so this PR remains open.

GPT-6 in Codex (reasoning effort not exposed) reviewed this item. Opus 5.5 High and muse-wonder via pi, thinking high both favored continuing in the older #12533; their agreement is not guaranteed to be independent. Opus considered the remaining handoff optimization not worth adopting, while muse-wonder recommended carrying it over for review. This waits on the maintainer’s choice among the competing fixes; neither branch is marked ready by this review.

@omarchybot

Copy link
Copy Markdown
Collaborator

I checked the merge at 7440e90 against current quattro, the resolver and launchers, review threads, #17074, and competing fixes #12533, #13240/#13241 and #15077. The merge preserves upstream MIME-app search order, CRLF handling and StartupWMClass lookup. This was source review; no worker tests ran because the competing-fix comparison leaves the older #12533 as the branch to pursue.

#12533 already includes the credited shared-parser and resolver work and preserves the entry’s browser arguments and broader wrappers. I queued this merge’s desktop-entry reading and quoted-escape handling for its next pass, so those differences are assessed there. The read-loop pattern comes from upstream; direct handoff for env-wrapped entries remains optional. These are different implementations, so this PR remains open.

GPT-6 in Codex (reasoning effort not exposed) reviewed this item. Opus 5.5 High and muse-wonder via pi, thinking high both favor continuing in #12533 after checking the current source; their agreement is not guaranteed to be independent. This waits on the maintainer’s choice among the competing fixes.

@omarchybot

Copy link
Copy Markdown
Collaborator

The latest merge from quattro keeps URLs containing --private intact. #12533 still covers more of #17074 because it preserves the browser flags from the desktop entry, and its review already has an unpublished resolution for the upstream --private change. I queued this PR’s handling of literal backslashes in quoted values for #12533. Related merge resolution

GPT-6 in Codex (reasoning effort unavailable), Opus 5.5 High and muse-wonder via pi, thinking high reviewed the source and favored #12533. Their agreement may reflect shared session context. Worker verification was skipped for this competing fix. This PR remains open for the maintainer’s decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy-launch-browser: first word of valid Exec=env VAR=… cmd entries is taken as the browser, so every link open silently runs env <url> and fails

2 participants