1

I just want to get rid of some Firefox context menu, such as: "set as desktop background" "email image" "bookmark link"

Now in Firefox, addons cannot change context menu. I have tried to add

#context-setDesktopBackground {display:none!important}

to the userChrome.css file, but it also not working. Is there any solution?

UPDATE I have tried also

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */

#context-setDesktopBackground {display:none!important}

And also not working:

enter image description here

I followed this tutorial.

Destroy666
  • 5,299
  • 7
  • 16
  • 35
XuMuK
  • 300
  • 4
  • 15

1 Answers1

2

I tested and the GitHub solution still works fine in latest Firefox. You likely failed to follow instructions in a way or another - please specify what you tried exactly in your question next time.

Here very simplified instructions for Windows 10 (based on this repo):

  1. Open about:config page in Firefox and search for toolkit.legacyUserProfileCustomizations.stylesheets. Set it to true if it's false.
  2. Create userChrome.css file in %APPDATA%\Mozilla\Firefox\Profiles\[profile-id]\chrome:
  • %APPDATA% is C:\Users\[user]\AppData\Roaming
  • profile-id dir should be the one with latest date modified, if you used Firefox recently
  • chrome dir at the end might not exist, you need to create that too then
  1. Add this to that file:
#context-sep-setbackground, #context-setDesktopBackground, #context-setDesktopBackground { display:none !important; }

This removes the Set Image as Desktop Background... entry and separators, as an example. Selectors are taken from here, you can check for other ones in other files, for each type of context menu.

  1. Save the file and (re)open Firefox. Menu entry should be gone.
Destroy666
  • 5,299
  • 7
  • 16
  • 35
  • Thank you! 'toolkit.legacyUserProfileCustomizations.stylesheets' - "legacy" means that it will not work after some time? – XuMuK May 21 '23 at 18:19
  • 1
    No problem. It is possible that it will get removed, but "legacy" itself doesn't necessarily mean it will be soon. Quick google for "`toolkit.legacyUserProfileCustomizations.stylesheets` deprecated" shows no interesting results, so if it's not deprecated then it's unlikely to disappear suddenly. And it is called that since 2019 BTW. – Destroy666 May 21 '23 at 18:21