How to change Mozilla Firefox quit shortcut?

I'm using Mozilla Firefox for Ubuntu(version - 39.0) I want to change the quit short-cut which is currently Ctrl+Q.. To some other keys, because sometime while closing tabs with Ctrl+W., I accidentally close my firefox.

How can I change it in my system? Is there any way to do it?


Solution 1:

Firefox offers no built-in editor for key bindings.

A solution exists to disable the shortcut starting with version Firefox 87, as given in the comments above by waldyrious. Thanks to Firefox developer Tom Schuster (user evilpie) and the patch to the 20 year-old bugzilla we have the updated answer on superuser, reproduced here:

In about:config set the preference

browser.quitShortcut.disabled true

and restart the browser for it to take effect.

Solution 2:

To disable the shortcut without installing extensions:

  1. Type about:config in the address bar
  2. Type browser.showQuitWarning in the search field
  3. Change the value to true

Solution 3:

Firefox does not allow changing shortcut keys out of the box (not even in About:config).

As far as I know, you have two options:

  • For only disabling ctrl+q, you can use the very simple Disable ctrl-q extension.

  • For customizing other shortcuts, including ctrl+q, you can install Menu Wizard. To use it, access Tools->Menu Wizard and click the keyboard icon on the top right (in LTR layout) to display the list of shortcuts and select a new one.

Note: the Customizable Shortcuts extension mentioned in the previous answer was discontinued and removed by its author (although the source code can still be found on github). Edit 2016-08-02: the add-on keybinder seems to be a successor to Customizable Shortcuts, although I haven't tried it personally.

Solution 4:

I use Xubuntu, but plain Ubuntu probably has a similar function. Because Firefox itself does not allow to change the Ctrl-Q shortcut, I decided to steal that key combination away from Firefox.

The system gets keystrokes before applications do, so I used the Settings/Keyboard/Application shortcuts to define Ctrl-Q to start some non obtrusive application. I chose the Whisker application menu, but pick whatever. And look: even when Firefox has focus, Ctrl-Q does not reach it.

Solution 5:

On Linux with Firefox Quantum, there is currently a bug that prevents extensions and explicit configuration from changing a builtin shortcut such as ctrl-Q. A workaround is to block it at the system level by e.g. installing the script from https://github.com/sasawat/firefox-ctrl-q-workaround and assigning it as the action of ctrl-Q as a global shortcut.