Spyke
FirefoxCSS·Firefox CustomsbyPleaseBeKindPlease

[SOLVED] Firefox 151: hide the search engine selection button

Hello!

In my userChrome.css file, I use the following code to hide the search engine selection button (circled in red in my image):

#urlbar-searchmode-switcher { #urlbar:not([searchmode]) & {
    margin: 0 !important;
    padding: 0 !important;
    width: 8px;
    overflow: hidden;
    opacity: 0;
} }

But in Firefox 151, this code no longer works. Is it possible to remove this button when there is only one (or no) search engine in the submenu? For example, here there is only “Startpage,” so the button to change the search engine serves no purpose. How can I adapt the code above so that it continues to work in Firefox 151?

Also, the “This time search with” menu shown here doesn't respect my usual margins between an element and a separator; for example, in the image, the margin between the "Startpage" search engine name and the separators above and below it should be smaller. How can I modify these elements?

Thank you very much in advance for your help!

View original on lemmy.world
lemmy.world

Is it possible to remove this button when there is only one (or no) search engine in the submenu?

I don't think that's possible. At least, not exactly how you you described it. You could get pretty close like this:

#urlbar:not([searchmode]) > .urlbar-input-container > .searchmode-switcher{
  margin: 0 !important;
  padding: 0 !important;
  max-width: 8px;
  overflow: hidden;
  opacity: 0;
}
#urlbar > .urlbar-input-container:has( > .searchmode-switcher-panel > #searchmode-switcher-panel-list-urlbar > panel-item + panel-item) > .searchmode-switcher {
  max-width: unset;
  opacity: 1;
}

However, when you disable or enable search-providers, the state of the panel only updates when it is shown the next time. So if the panel had only single item and thus it is not shown, and you go to settings and enable another one, then the button will stay hidden until you open the panel once - which is a bit tricky since the button is hidden.

As for the separators, they seem to have their margin set with !important your userChrome probably won't override it. But luckily the value is set to var(--space-small) so you could possibly just modify that. Something like this:

panel-list > hr{
  --space-small: 0;
}
2

the button will stay hidden until you open the panel once - which is a bit tricky since the button is hidden

It's tricky... but it's still doable, since you can always click on the first 8 pixels of the address bar to make the button appear. So I think your solution is excellent! Thank you so much!

the value is set to var(--space-small) so you could possibly just modify that

Yes, that's perfect! Thank you so much for your help!

1

You reached the end

[SOLVED] Firefox 151: hide the search engine selection button | Spyke