Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

5 Answers 5

up vote 20 down vote accepted

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 Ctrl+Q to disable 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.

share|improve this answer
    
thanks, no more accidental closing :) –  Khaja Minhajuddin Aug 11 '10 at 11:51
    
Awesome answer, and how did you do the styled button shortcuts! :) –  jathanism Aug 11 '10 at 13:37
2  
@jathanism: Use the kbd html tag. –  Lars Haugseth Aug 11 '10 at 15:33
3  
When you want to press Ctrl-Q the window will close. You can never assign this key using this method –  Anwar Shah Oct 15 '12 at 6:23
    
@AnwarShah -- I just tried this solution and it worked for me. –  Sam King Apr 20 at 5:22
add comment

If Ctrl + Q closes the keyboard settings window, like it did for me, 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. Then reboot the PC. This worked for me as opposed to the accepted answer.

share|improve this answer
    
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> –  vishvAs vAsuki May 28 '13 at 21:26
    
I had to restart gnome session, but this worked, thanks! –  vishvAs vAsuki Jun 25 at 18:15
add comment

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

share|improve this answer
1  
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. –  Source Lab Aug 11 '10 at 7:33
    
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. –  mariachris Aug 11 '10 at 9:04
    
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. –  Source Lab Aug 11 '10 at 11:13
add comment

There is no easy fix since these keyboard shortcuts are defined directly in the program source. If you are up for it, google around for gtkrc, should be possible to overwrite, but I were unsuccessful in doing so. It is not an easy task, but you might have more luck if you go to the gtk developer mailinglist. or on the Gnome IRC (irc.gnome.org) in the #gtk or #gnome channels.

share|improve this answer
add comment

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 reach Firefox). It just do nothing.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.