Skip to content

Reflect default browser changes in bindings and webapps - #871

Merged
dhh merged 16 commits into
omacom:devfrom
ankurkotwal:config-browser
Aug 23, 2025
Merged

dhh merged 16 commits into
omacom:devfrom
ankurkotwal:config-browser

Conversation

@ankurkotwal

Copy link
Copy Markdown
Contributor

I prefer using Google Chrome over Chromium but found that Chromium had been hard coded throughout Omarchy. This change introduces a omarchy-browser wrapper that respects the user's xdg-settings for default-web-browser. This extends to webapps as well.

The default installation still uses Chromium but if the user changes their default browser, the SUPER+B bind will use the new default as will all webapps.

Additionally, the new omarchy-browser wrapper script is extensible so if other browsers needed specific launch flags, they could easily be added in.

@ankurkotwal ankurkotwal changed the title Make default browser changes reflected in bindings and webapps Reflect default browser changes in bindings and webapps Aug 17, 2025
@alexperreault

Copy link
Copy Markdown
Contributor

I believe this would break webapps for users with firefox as their default browser

@ankurkotwal

Copy link
Copy Markdown
Contributor Author

I think you mean that if the default browser is Firefox, then webapps will break as Firefox isn't supported in Omarchy as a webapp launcher. I'll update my code so that webapps are only launched by Chromium or Google Chrome (depending on system defaults). If you have Firefox set as a default, it'll still fall back to Chromium for webapps (that's the way it is prior to this change).

Will submit changes soon.

@ankurkotwal

Copy link
Copy Markdown
Contributor Author

@alexperreault I've made the necessary changes. WDYT?

@alexperreault

Copy link
Copy Markdown
Contributor

Whilst I'm no maintainer, I like your solution splitting browser and webapps!

@sailoz

sailoz commented Aug 18, 2025 •

Copy link
Copy Markdown
Contributor

Some people user brave (chromium based) in place of choromium for both browser, and hence webapp.
there are more browsers than you can imagine. (zen, qute, dolphine, edge ). Would this able to cope ?

@ankurkotwal

Copy link
Copy Markdown
Contributor Author

@sailoz Prior to this change, Omarchy had no special support for brave. Adding that support shouldn't be the responsibility of this change. Brave users will automatically benefit from default browser access through this change. It won't make a difference for the webapps.

I have authored this change with extensibility in mind so you can extend omarchy-webapp and the get_args_for_browser function within omarchy-browser-utils to support additional browsers.

@ankurkotwal

Copy link
Copy Markdown
Contributor Author

I've also added a migration script. Until there's any further code review comments, this PR is complete.

@ryanrhughes

Copy link
Copy Markdown
Collaborator

I like the idea of consistency and a simpler way to make this change but it does come with the inherent Firefox challenge you've already encountered.

If we were to keep this, I'd suggest we rename to omarchy-launch-browser / omarchy-launch-webapp for consistency and clarity around what that bin does.

Secondarily, I think we need to simplify the approach dramatically. There's a ton of code here, parsing .desktop files, etc. to perform an action that's really pretty simple. It'd be better to take a much more direct approach that really boils it down to the launch exec and flags.

@ankurkotwal

Copy link
Copy Markdown
Contributor Author

@ryanrhughes thank you for the feedback. I agree with what you've said and have submitted a new commit that should address the concern. The code is much simpler but trades off flexibility for hardcoding assumptions (i.e. google-chrome.desktop -> google-chrome-stable). I think those assumptions are pretty sound though. All feedback welcome.

@BartoGabriel

Copy link
Copy Markdown

Just a quick note: Microsoft Edge can also launch web applications using the same --app= flag as Chromium and Google Chrome. It’s Chromium-based, so supporting it should be straightforward.

@ankurkotwal

Copy link
Copy Markdown
Contributor Author

@BartoGabriel I'm sure there will be lots of other Chromium based browsers that this commit doesn't cover. I've built this PR to be extensible so folks can easily add their choices in as a separate PR. I've included the suggested browsers in these comments but won't add any more as that should be a separate PR.

@ryanrhughes what else do you feel that this PR needs in order to be merged?

@dhh

dhh commented Aug 22, 2025

Copy link
Copy Markdown
Contributor

I like the idea, but it's too much code. We should have Setup > Default > Browser > [List all the majors] in the Omarchy menu. When you pick one, it'll both ensure that it gets installed, then it'll write to ~/.local/state/omarchy/default/browser and ~/.local/state/omarchy/default/webapp with what's needed to start. The files will then be read by omarchy-launch-browser and omarchy-launch-webapp. No munging of desktop files etc. This should be like 20 lines tops. Thanks for exploring it!

@BartoGabriel

Copy link
Copy Markdown

@dhh, it would be great to have a simple installer similar to archinstall, where basic preferences can be selected before installation—like choosing the default browser, or for example being able to pick between Docker and Podman.

Are you considering (or do you have any plans for) something like this?

@ankurkotwal

ankurkotwal commented Aug 23, 2025 •

Copy link
Copy Markdown
Contributor Author

I like the idea, but it's too much code. We should have Setup > Default > Browser > [List all the majors] in the Omarchy menu. When you pick one, it'll both ensure that it gets installed, then it'll write to ~/.local/state/omarchy/default/browser and ~/.local/state/omarchy/default/webapp with what's needed to start. The files will then be read by omarchy-launch-browser and omarchy-launch-webapp. No munging of desktop files etc. This should be like 20 lines tops. Thanks for exploring it!

@dhh is this already been worked on somewhere?

One concern I have with this solution is that its introducing a different way to set default browsers. Most of the browsers ask users if they'd like to set at default. The solution you're proposing won't be compatible with it. That's why I was using "xdg-settings" to get the default browser.

@ryanrhughes
ryanrhughes changed the base branch from master to dev August 23, 2025 15:09
@ryanrhughes

Copy link
Copy Markdown
Collaborator

@dhh I simplified this quite a lot and I think it's in a good spot.

@ankurkotwal is right that using xdg-settings is the right way to go on this one. That makes it compatible with the browsers themselves and how other apps interact.

We don't really have any need to add anything to the Omarchy menu (though we could make it part of installing those browsers) because the xdg-settings works with the built in "Set as default" button inside of a browser. So if you launch Firefox, click Set as Default, everything will start launching in Firefox.

xdg-settings get default-web-browser returns a .desktop file so we have to do a little bit of parsing but that's been boiled to a mimium.

Webapps aren't supported in Firefox-based browsers so we just have a little logic to fallback to Chromium if you have anything that isn't set in the nice list.

I also noticed that for apps, we were setting --name and --class but that those aren't respected if --app is defined. If you launch a Chromium browser with those flags and without --app, they work, but with it, they're just ignored. Because of this, I didn't invest any time or logic into preserving those since they're really just useless and probably going to confuse us later when we think they should be working. 🙃

@dhh

dhh commented Aug 23, 2025

Copy link
Copy Markdown
Contributor

You're right. This is great. Just tested it with all the browsers. Only failure state will be if people install Firefox, then uninstall Chrome, then their webapps will break. But easy fix just to install that back again.

@dhh
dhh merged commit 5e3d0d8 into omacom:dev Aug 23, 2025
@ankurkotwal

Copy link
Copy Markdown
Contributor Author

Thanks @ryanrhughes and @dhh

@ankurkotwal
ankurkotwal deleted the config-browser branch August 24, 2025 07:41
OmarSkalli pushed a commit to OmarSkalli/omarchy that referenced this pull request Aug 26, 2025
* Abstract default browser to omarchy-browser (a wrapper)

* Fix the omarchy-browser command as it used to loop. Extract info from the browser .desktop files.

* Clean up and fix bugs

* Cleanup unused change

* Fix indentation

* Separate out omarchy-browser from omarchy-webapp so that we don't break webapps for browsers other than Chromium or Google Chrome.

* Fix incorrect function call

* Add a migration script

* Migration script fixes

* Simplify the browser and webapp commands. Rename commands to align with launch terminology.

* Add support for Microsoft Edge, Opera and Vivaldi

* Fix errors

* Remove --name and --class -- They're not respected when --app is defined

* We don't ship with Chrome

* Simplify launchers

* Use launch commands everywhere

---------

Co-authored-by: Ryan Hughes <[email protected]>
jakeprime pushed a commit to jakeprime/omarchy that referenced this pull request Aug 26, 2025
* Abstract default browser to omarchy-browser (a wrapper)

* Fix the omarchy-browser command as it used to loop. Extract info from the browser .desktop files.

* Clean up and fix bugs

* Cleanup unused change

* Fix indentation

* Separate out omarchy-browser from omarchy-webapp so that we don't break webapps for browsers other than Chromium or Google Chrome.

* Fix incorrect function call

* Add a migration script

* Migration script fixes

* Simplify the browser and webapp commands. Rename commands to align with launch terminology.

* Add support for Microsoft Edge, Opera and Vivaldi

* Fix errors

* Remove --name and --class -- They're not respected when --app is defined

* We don't ship with Chrome

* Simplify launchers

* Use launch commands everywhere

---------

Co-authored-by: Ryan Hughes <[email protected]>
gocs pushed a commit to gocs/omarchy that referenced this pull request Aug 28, 2025
* Abstract default browser to omarchy-browser (a wrapper)

* Fix the omarchy-browser command as it used to loop. Extract info from the browser .desktop files.

* Clean up and fix bugs

* Cleanup unused change

* Fix indentation

* Separate out omarchy-browser from omarchy-webapp so that we don't break webapps for browsers other than Chromium or Google Chrome.

* Fix incorrect function call

* Add a migration script

* Migration script fixes

* Simplify the browser and webapp commands. Rename commands to align with launch terminology.

* Add support for Microsoft Edge, Opera and Vivaldi

* Fix errors

* Remove --name and --class -- They're not respected when --app is defined

* We don't ship with Chrome

* Simplify launchers

* Use launch commands everywhere

---------

Co-authored-by: Ryan Hughes <[email protected]>
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.

6 participants