Ubuntu – How to hide/disable close buttons for GNOME windows

gnomemaximizedtitlebarwindow-buttonswindow-decoration

I am using the Pixel Saver extension for GNOME Shell, similar to the old Maximus extension for GNOME 2 / Unity. When I maximise a window, the title and menu bars are hidden.

But I don't want the minimise, maximise or close buttons to appear in the Activity Bar. Instead of messing with window buttons itself, Pixel Saver honours the GNOME settings, so I have been able to remove the minimise and maximise buttons by disabling them in Tweak Tool.

How do I similarly disable/remove the close (X) button?

(I guess this is the opposite of "No close button in GNOME 3")

Best Answer

You may try one of the following.

1. Tweak Pixel Saver code

You may tweak Pixel Saver to get rid of the buttons by following these steps:

  1. Go to Pixel Saver directory viz. ~/.local/share/gnome-shell/extensions/pixel-saver@deadalnix.me/ (if it is installed locally).
  2. Open the extension.js file with a text editor.
  3. Look for the three lines

    • Buttons.init(extensionMeta);
    • Buttons.enable();
    • Buttons.disable();

    and comment them out by putting // before the lines (i.e. change Buttons.init(extensionMeta); to //Buttons.init(extensionMeta); and so on).

  4. Save the extension.js file.
  5. Restart GNOME shell by pressing alt+f2 and then entering r and pressing enter.

Note: These changes to the extension.js file will most probably be overwritten by each update of the extension.

This will get rid of window buttons for maximised windows from the "Activities" bar at the top. I believe that's what you wish to achieve.

2. GNOME settings

If you want to get rid of all the buttons from all windows, run the following command in Terminal:

gsettings set org.gnome.desktop.wm.preferences button-layout :

3. Use a different extension

No Title Bar is a fork of Pixel Saver that specifically implements this functionality.