How can I disable Ctrl+Q for all applications (system wide)?

20,748

Solution 1

The best way is to disable the keyboard setting in your specific application. For Firefox there is an extension keyconfig. This allows you to change keyboard settings.

If you want to disable Ctrl+Q for your whole system, I would suggest to make a new setting:

  1. Go to System -> Preferences -> Keyboard settings
  2. Click Add
  3. Give it a name like fake setting and enter /bin/false as command. Apply your changes.
  4. Click on 'Disabled' and press Ctrl+Q.

Now you should have a new entry with your applied name and your keyboard setting. Every time you press Ctrl+Q your system will run the command /bin/false which basically does nothing. So this is a workaround to disable the setting.

Solution 2

Probably inserting the shortcut under System -> Preferences -> Keyboard Shortcuts and "disabling" it should do the trick.

Solution 3

You can go to System → PreferencesKeyboard Shortcuts and assign this combo to an unused action. For example I assigned Ctrl+Q to switch to workspace 12 (no, I don't have 12 workspaces).

As a result this system wide setting overrides application one and Ctrl+Q no longer closes Firefox (likely the combo never reaches Firefox). It just does nothing.

Solution 4

For newer Firefox versions, you can disable it as follows:

  1. Go to about:config.
  2. Set browser.quitShortcut.disabled to true.
  3. Restart the browser.

For other applications, the steps will differ. Chrome no longer closes on Ctrl+Q, so there is no need to change anything there. Note that in many other applications, Ctrl+Q is a useful shortcut, so disabling it system wide would break that functionality.

Solution 5

If Ctrl + Q closes the keyboard settings window, like it did for me, youi can do the following:

  1. Set the shortcut to another value.
  2. Close the window and wait until the updated shortcut appears somewhere in ~/.gconf/desktop/gnome/keybindings/*.
  3. Open that file and edit the stringvalue of that command to read <Primary>q.
  4. Reboot the PC.

This worked for me as opposed to the accepted answer.

Share:
20,748

Related videos on Youtube

Khaja Minhajuddin
Author by

Khaja Minhajuddin

Recently, I've been building a simple web host which allows you to create and manage websites using Dropbox (http://www.websrvr.in/). Would love to get your feedback on that :) I am also the CEO of a Micro ISV called Cosmicvent. I work on ASP.NET MVC and Ruby on Rails. I am passionate about programming and always looking for more work :)

Updated on September 17, 2022

Comments

  • Khaja Minhajuddin
    Khaja Minhajuddin over 1 year

    A lot of applications like Firefox, Chrome etc, get closed when I accidentally press Ctrl+Q instead of Ctrl+W because of the proximity of the Q and W keys on the keyboard. Is there a way this shortcut can be removed or reset on a system wide basis?

  • LassePoulsen
    LassePoulsen over 13 years
    Instead of just typing away do a bit of research if your not 100% certain. It would have costed you 2 secs to find that it is not there.
  • mariachris
    mariachris over 13 years
    Well, it is if you add it, isn't it? Maybe I didn't express myself correctly. But apparently, there is an easy fix since it's worked for me.
  • LassePoulsen
    LassePoulsen over 13 years
    Maybe not, it is still not a very nice way to do it... This way you will never be able to use Ctrl+W for any thing! For instance in bash Ctrl+W means delete word backwards.
  • yood
    yood over 13 years
    Awesome answer, and how did you do the styled button shortcuts! :)
  • Lars Haugseth
    Lars Haugseth over 13 years
    @jathanism: Use the kbd html tag.
  • Anwar
    Anwar over 11 years
    When you want to press Ctrl-Q the window will close. You can never assign this key using this method
  • vishvAs vAsuki
    vishvAs vAsuki almost 11 years
    Even that did not work for me. I tried the below: <?xml version="1.0"?> <gconf> <entry name="action" mtime="1369776357" type="string"> <stringvalue>/bin/false </stringvalue> </entry> <entry name="name" mtime="1369776357" type="string"> <stringvalue>dummy2</stringvalue> </entry> <entry name="binding" mtime="1369776299" type="string"> <stringvalue>&lt;Primary&gt;q</stringvalue> </entry> </gconf>
  • Sam King
    Sam King about 10 years
    @AnwarShah -- I just tried this solution and it worked for me.
  • vishvAs vAsuki
    vishvAs vAsuki almost 10 years
    I had to restart gnome session, but this worked, thanks!
  • falconepl
    falconepl almost 9 years
    Kind of a nice and easy fix, but I rather recommend to use a browser's extension. Using system preferences to override Ctrl+Q system-wide would result in some applications being unable to use that shortcut - e.g. you won't be able to use Ctrl+Q in IntelliJ IDEA to show documentation pop-up.
  • Javier Rivera
    Javier Rivera almost 9 years
    Well, the question is about disabling this combo system-wide not app per app ;).
  • falconepl
    falconepl almost 9 years
    And that's why you've got +1 from me... ;)
  • aaaaaa
    aaaaaa almost 8 years
    I'm using GNOME Shell 3.20.2 on Archlinux and this worked for me.
  • Murmel
    Murmel over 7 years
    It does work and it is exactly what has been asked for. @LassePoulsen why should CTRL+W be affected from this?
  • Liz
    Liz over 7 years
    this is so hacky but it works splendidly. Ubuntu GNOME 16.04.
  • Mark Jeronimus
    Mark Jeronimus over 7 years
    Fail. This doesn't let me use Ctrl+Q in an application that defines this shortcut by default (e.g. IntelliJ)
  • netchkin
    netchkin about 7 years
    @MarkJeronimus: guess that's a problem of the application, then. But I'm sure you can disable that in IntelliJ as well.
  • Mark Jeronimus
    Mark Jeronimus about 7 years
    I want it in IntelliJ because it's a standard shortcut across platforms
  • Damian Yerrick
    Damian Yerrick over 6 years
    keyconfig no longer works in Firefox 57.
  • bytebuster
    bytebuster over 5 years
    As of mid-2018, this must be the correct answer.
  • Paul
    Paul about 4 years
    System-wide disable of Ctrl+Q is all that worked for me. I use the command true.
  • qdinar
    qdinar over 3 years
    this works in ubuntu mate 20.04, but the program is named like "keyboard shortcuts"
  • rubo77
    rubo77 about 3 years
    I love this solution, but I modified it to use Ctrl+Q as "Hide Window" instead
  • preIdiot
    preIdiot almost 3 years
    This is not an appropriate solution because the command "a" will run every time Ctrl+Q is pressed. And it will override shortcuts of other applications too.