wico979's website

  • Home

  • Math

  • Chess

  • Miscellaneous

  • Removing the maximize, minimize and close window buttons on Firefox

    This post is about how one can remove the maximize, minimize and close window buttons on Firefox. What I did worked on Firefox 95.0.2 (64-bit) on Windows 10, but it probably works on other versions and OS's as well.

    We will get rid of these buttons.

    1. Why would you want to do this?

    I'm clumsy and (used to, before I removed the buttons) accidentally click the close window (X) button a lot. Normally Firefox would warn me when I tried to close a window with multiple tabs (there is a setting to enable this). However apparently it doesn't count pinned tabs (This only happens if you close with the X button. It counts (as expected) the pinned tabs if you close it with the keyboard shortcut Ctrl+Shift+W. I have no idea how they managed to have it work properly in one case but not in the other). This means if you have two pinned tabs and one tab which isn't pinned, it will close without warning, even though it should because there are three tabs.

    This is obviously undesirable, and can result in lost work. One may ask why I don't simply restore my session after accidentally closing the window. My Firefox is configured in such a way that it doesn't save history (in particular, it's on the "always use private browsing" mode. Another unrelated but interesting bug/feature of Firefox is that if you use a "proper" private window, it doesn't warn before closing even if that setting is turned on, but if you turn on the "always use private browsing" setting, it does.), which has the side effect of being unable to restore the last session.

    So I started looking for ways to disable or remove the buttons on the top right corner.

    2. Actually removing the buttons

    Type about:config in the address bar in Firefox. You will see a warning:

    Click "Accept the risk and continue". Type stylesheets to the search bar. Find the row with toolkit.legacyUserProfileCustomizations.stylesheets on the left. Press the toggle button on the right to change its value from false to true. Now the row is supposed to look like this:

    Now type about:support in the address bar. You will see a page titled "Troubleshooting information". Find your profile folder by pressing Ctrl+F and typing "profile folder". It looks like this (of course your username and profile name will be different):

    Click the "Open Folder" button. Now create a new folder named chrome (all lowercase). Double click on this folder. Click the View tab in Explorer (I'm assuming you are using Windows), and tick the box that says "File name extensions". Now create a file called userChrome.css. Open this file with your favorite text editor, type ".titlebar-buttonbox-container{ display:none }" (without the quotes), then save. Restart Firefox for the changes to apply.

    3. The buttons are no more

    Now you have got rid of the buttons, and the top of Firefox will look like this (of course your add-ons might be different):

    Notice that the maximize, minimize and close window buttons are missing. There is no longer the risk of accidentally closing your browser window.

    4. Sources

    This post incorporates information from various sources:

    This Firefox support thread, which came up in my Google search

    This tutorial on Reddit explaining how to create your userChrome.css file

    This Reddit thread explaining exactly what to type in order to remove the buttons