How can I disable Ctrl+Q for all applications (system wide)?
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:
- Go to System -> Preferences -> Keyboard settings
- Click Add
- Give it a name like fake setting and enter
/bin/false
as command. Apply your changes. - 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 → Preferences → Keyboard 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:
- Go to
about:config
. - Set
browser.quitShortcut.disabled
totrue
. - 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:
- Set the shortcut to another value.
- Close the window and wait until the updated shortcut appears somewhere in
~/.gconf/desktop/gnome/keybindings/*
. - Open that file and edit the
stringvalue
of that command to read<Primary>q
. - Reboot the PC.
This worked for me as opposed to the accepted answer.
Related videos on Youtube
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, 2022Comments
-
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 over 13 yearsInstead 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 over 13 yearsWell, 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 over 13 yearsMaybe 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 over 13 yearsAwesome answer, and how did you do the styled button shortcuts! :)
-
Lars Haugseth over 13 years@jathanism: Use the
kbd
html tag. -
Anwar over 11 yearsWhen you want to press
Ctrl-Q
the window will close. You can never assign this key using this method -
vishvAs vAsuki almost 11 yearsEven 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><Primary>q</stringvalue> </entry> </gconf>
-
Sam King about 10 years@AnwarShah -- I just tried this solution and it worked for me.
-
vishvAs vAsuki almost 10 yearsI had to restart gnome session, but this worked, thanks!
-
falconepl almost 9 yearsKind 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 almost 9 yearsWell, the question is about disabling this combo system-wide not app per app ;).
-
falconepl almost 9 yearsAnd that's why you've got +1 from me... ;)
-
aaaaaa almost 8 yearsI'm using GNOME Shell 3.20.2 on Archlinux and this worked for me.
-
Murmel over 7 yearsIt does work and it is exactly what has been asked for. @LassePoulsen why should CTRL+W be affected from this?
-
Liz over 7 yearsthis is so hacky but it works splendidly. Ubuntu GNOME 16.04.
-
Mark Jeronimus over 7 yearsFail. This doesn't let me use Ctrl+Q in an application that defines this shortcut by default (e.g. IntelliJ)
-
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 about 7 yearsI want it in IntelliJ because it's a standard shortcut across platforms
-
Damian Yerrick over 6 yearskeyconfig no longer works in Firefox 57.
-
bytebuster over 5 yearsAs of mid-2018, this must be the correct answer.
-
Paul about 4 yearsSystem-wide disable of
Ctrl+Q
is all that worked for me. I use the commandtrue
. -
qdinar over 3 yearsthis works in ubuntu mate 20.04, but the program is named like "keyboard shortcuts"
-
rubo77 about 3 yearsI love this solution, but I modified it to use Ctrl+Q as "Hide Window" instead
-
preIdiot almost 3 yearsThis 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.