Ubuntu – How to make alt-w close current tab, not current window, in Gnome Shell

desktop-environmentsgnomeshortcut-keystabswindow

I'm trying Gnome Shell, after moving over from Unity. In Unity, I'd press ctrl+w to close the current tab, and alt+F4 to close the current window (e.g. in gedit and Firefox).

Now, in Gnome Shell, ctrl+w is closing the current window instead, and alt+F4 does nothing. I've checked the menu of Firefox, and it says File > Close Tab is ctrl+w as expected. Selecting this item works also.

When I right click my menubar, the minimise/maximise popup menu appears. The last menu-item is "Close", with the associated keyboard shortcut of ctrl+w. Presumably this overrides the application-specific "Close tab" shortcut. I checked System Settings > Keyboard > Shortcuts and "Close Window" was set to "Disabled", so I'm not sure what's going on there…

How can I restore the expected behaviour?

Best Answer

Open a terminal with Ctrl-Alt-T keyboard shortcut and try executing this command to fix the problem:

 gsettings set org.gnome.desktop.wm.keybindings close "['<Alt>F4']"

This command will set Alt-F4 as the default binding for closing the window. Then you should use the regular Ctrl-W to close tabs.

After the command, try testing it. Hope this will help