omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Defaults → Browser menu can't reflect the actual xdg default when it's outside the hardcoded list

Open PapaPandroni opened this issue 3 months ago • 2 comments

What happened

When the XDG default browser is one Omarchy doesn't know about, Defaults → Browser cannot show it, cannot check it, and — if none of the seven known browsers are installed either — offers nothing to select.

On my machine librewolf is the default and chromium is the only browser from Omarchy's list that is installed. The menu renders exactly one row, "Chromium", unchecked. There is no indication that LibreWolf is in fact the default, and no way to pick it back if I switch away.

Expected

The menu reflects the actual xdg-settings default, even when it is a browser outside the built-in list.

Steps to reproduce

  1. On a system with chromium installed, also install a browser not in Omarchy's list (librewolf, vivaldi, waterfox, …).
  2. xdg-settings set default-web-browser librewolf.desktop
  3. Open the Omarchy menu → Setup → Defaults → Browser.
  4. Only "Chromium" is listed, unchecked. LibreWolf is absent.

Cause

default/omarchy/omarchy-menu.jsonc:143-149 hardcodes seven rows, each gated on omarchy-cmd-present <browser>, and each checked compares against a short name:

"checked":"[[ \"$(omarchy-default-browser)\" == \"chromium\" ]]"

omarchy-default-browser with no args maps seven known desktop ids to those short names, and otherwise falls through to:

*) env -u BROWSER xdg-settings get default-web-browser ;;

So for anything outside the list it emits a raw desktop id (librewolf.desktop) in a different format from the short names every checked compares against. No row can ever match, and no row exists for the browser anyway.

Worth noting omarchy-launch-browser already handles this correctly — it reads xdg-settings and resolves Exec= from the desktop file, so LibreWolf launches fine via Super+Shift+Return. It is only the menu that can't represent the state.

Suggested fix

Have omarchy-default-browser accept and report arbitrary .desktop ids rather than a fixed list, and let the menu derive its rows from the installed x-scheme-handler/https handlers (xdg-mime/desktop-file scan) instead of a hardcoded set. That keeps xdg-settings as the single source of truth, consistent with the reasoning in #4340.

System

  • Omarchy 4.0.1-1
  • chromium 151.0.7922.173-1, librewolf 154.0_2-1

PapaPandroni avatar Aug 29 '26 08:08 PapaPandroni

I use helium as my default browser which was working fine on the previous version of Omarchy. After updating to Quattro was trying to run omarchy default browser but that command is limited to only the group of browsers that Omarchy has available

tommyneu avatar Aug 31 '26 15:08 tommyneu

Reproduced on a clean Omarchy worker at current quattro (c352b62d6). With a librewolf.desktop set as the XDG default, omarchy-default-browser prints librewolf.desktop rather than a short name, so none of the Browser rows in default/omarchy/omarchy-menu.jsonc:155-161 can match it and none is checked. omarchy-default-browser librewolf is refused with the usage message (bin/omarchy-default-browser:27-39), so there is also no way to select it from the command line. Setting chromium.desktop back reads as chromium, as expected.

One part of the report has changed since 4.0.x: on quattro the seven rows are no longer hidden when a browser isn't installed (choosing a missing one installs it), so the menu now shows all seven, all unchecked, instead of just Chromium. The browser you actually use is still neither shown nor selectable.

Nothing else reads the no-argument output as a short name: omarchy-launch-browser and omarchy-remove-browser read the desktop ID directly, which is why LibreWolf still launches with Super+Shift+Return. The defect is confined to the Defaults menu and the setter.

No fix is opened, because the fix is a choice about what the menu should be rather than a correction: show the current external default as a checked row, offer every installed x-scheme-handler/https handler (which needs a new menu provider in the shell, since the Browser submenu is static), and/or let omarchy-default-browser accept arbitrary desktop IDs. That is for the maintainer to decide. Open pull requests near this: #12132 and #8801 add Helium to the supported list, which would cover the Helium case in the comment above but not browsers in general; #9431 changes how the default is read and leaves unknown browsers as desktop IDs, so it does not add a row either.

Checked by Claude Opus 5.5 and, as a second opinion, Codex at medium effort, which reached the same conclusion on every point; its independence from this review is not guaranteed. Waiting on the maintainer.

omarchybot avatar Oct 09 '26 07:10 omarchybot