-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firefox: support setting search engine & adding custom engines #2984
Conversation
98d25b1
to
16dc28a
Compare
Excited to see this, thank you! Any chance it can be merged soon? |
16dc28a
to
19c0bd4
Compare
I decided to rename the |
Is there any blocker for this to be merged? :( |
@rycee , sorry about bothering you, but could you have a look at this please? |
486b3c4
to
37aa416
Compare
37aa416
to
c6da8e1
Compare
1ad3812
to
9d7bb1f
Compare
9d7bb1f
to
bc2c54f
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/firefox-search-engine-shortcuts/22177/5 |
bc2c54f
to
42a6678
Compare
@kira-bruneau seems like the P/R doesn't work on macOS:
Though I don't see anything linux-specific in the python script (formula, script), do you think you may just incorporate that script into your PR? |
NixOS/nixpkgs#196021 - I guess that may help |
@pshirshov neither of us are maintainers here; we only provided feedback on the code. |
@rycee : please... |
5c956ea
to
71397e5
Compare
With this change, it's now possible to configure the default search engine in Firefox with programs.firefox.profiles.<name>.search.default and add custom engines with programs.firefox.profiles.<name>.search.engines. It's also recommended to enable programs.firefox.profiles.<name>.search.force = true since Firefox will replace the symlink for the search configuration on every launch, but note that you'll loose any existing configuration by enabling this.
Thanks! Fixed a few minor issues and merged to master now. I think some of the code could benefit by having more let bindings to make it a bit more understandable, see e.g. the definition of |
To be honest, even as it is it's totally understandable and it's a real game changer. Many thanks! |
Indeed, this is a very nice feature and @kira-bruneau did a great job implementing it! So, I hope my comment above does not seem too negative, it was meant purely as constructive criticism. |
@rycee Yeah... I was worried it was too messy / hard to follow 😅, but there's also just a lot going on to get this to work. I'll try to clean it up some more. Would it make sense to try to split this into a separate file? |
@kira-bruneau No need for a separate file, I think. It seems to me the thing that would help readability the most in this case is "naming things". For example, instead of having, loosely modeled on imap (i: x: long expression) xs ++ map (y: long expression) (expression) one could try doing something like let
descriptiveName1 = i: x: long expression;
descriptiveName2 = y: long expression;
descriptiveName3 = expression;
in
imap descriptiveName1 xs ++ map descriptiveName2 descriptiveName3 the |
This API was added to home-manager in nix-community/home-manager#2984
Description
With this change, it's now possible to configure the default search engine in Firefox with
programs.firefox.profiles.<name>.search.default
and add custom engines withprograms.firefox.profiles.<name>.search.engines
.It's also recommended to enable
programs.firefox.profiles.<name>.search.force = true
since Firefoxwill replace the symlink for the search configuration on every launch, but note that you'll loose any existing configuration by enabling this.
Here's an example of how I'm using this in my home-manager config: https://gitlab.com/kira-bruneau/home-config/-/blob/028c1a50c82f8cad2be3d6693e6c53c67bf7e7c2/package/firefox/default.nix#L9-93.
NOTE: The hash verification is only required for custom search engines, it's ignored when setting your default engine to a builtin engine, but I set this up to still generate the hash anyway to be consistent with Firefox.
Closes #2318 @pshirshov
Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
- If this PR adds a new moduleAdded myself as module maintainer. See example.
Added myself and the module files to
.github/CODEOWNERS
.