How to disable Ctrl+Q shortcut in Firefox on Linux











up vote
22
down vote

favorite
2












Since Firefox 57 there is no way to disable Ctrl+Q shortcut by plugin on Linux (see this bug). All workarounds I've found are based on setting the global Ctrl+Q shortcut to "steal" it from Firefox. But this will disable this shortcut in every application, and I want to disable this shortcut only in Firefox, without affecting any other app.



Is there a way to disable or catch shortcut only for one application? I'm using Ubuntu with Unity.










share|improve this question






















  • Interesting question, but the answer may depend on the use case. Accidental key presses? Kiosk mode?
    – l0b0
    Apr 29 at 21:13






  • 2




    @l0b0 Accidental key presses. This is regular PC, nothing fancy.
    – rob006
    Apr 29 at 21:14










  • In that case, do you have more details? I'm just checking if there is some way the system can be set up to Do What You Want™, such as save the tabs when you quit, to avoid something which I suspect will be a brittle hack.
    – l0b0
    Apr 29 at 21:46






  • 4




    @l0b0 I want to prevent closing browser by accidental key presses. There is a too many things are changing after closing browser (closing sessions, terminating connections), I would prefer to prevent closing browser than fixing its effects.
    – rob006
    Apr 29 at 22:30






  • 1




    Disabling Ctrl+Q for Firefox on Linux will have to be a brittle hack unless Mozilla does something about it.
    – dsstorefile1
    Apr 29 at 22:46















up vote
22
down vote

favorite
2












Since Firefox 57 there is no way to disable Ctrl+Q shortcut by plugin on Linux (see this bug). All workarounds I've found are based on setting the global Ctrl+Q shortcut to "steal" it from Firefox. But this will disable this shortcut in every application, and I want to disable this shortcut only in Firefox, without affecting any other app.



Is there a way to disable or catch shortcut only for one application? I'm using Ubuntu with Unity.










share|improve this question






















  • Interesting question, but the answer may depend on the use case. Accidental key presses? Kiosk mode?
    – l0b0
    Apr 29 at 21:13






  • 2




    @l0b0 Accidental key presses. This is regular PC, nothing fancy.
    – rob006
    Apr 29 at 21:14










  • In that case, do you have more details? I'm just checking if there is some way the system can be set up to Do What You Want™, such as save the tabs when you quit, to avoid something which I suspect will be a brittle hack.
    – l0b0
    Apr 29 at 21:46






  • 4




    @l0b0 I want to prevent closing browser by accidental key presses. There is a too many things are changing after closing browser (closing sessions, terminating connections), I would prefer to prevent closing browser than fixing its effects.
    – rob006
    Apr 29 at 22:30






  • 1




    Disabling Ctrl+Q for Firefox on Linux will have to be a brittle hack unless Mozilla does something about it.
    – dsstorefile1
    Apr 29 at 22:46













up vote
22
down vote

favorite
2









up vote
22
down vote

favorite
2






2





Since Firefox 57 there is no way to disable Ctrl+Q shortcut by plugin on Linux (see this bug). All workarounds I've found are based on setting the global Ctrl+Q shortcut to "steal" it from Firefox. But this will disable this shortcut in every application, and I want to disable this shortcut only in Firefox, without affecting any other app.



Is there a way to disable or catch shortcut only for one application? I'm using Ubuntu with Unity.










share|improve this question













Since Firefox 57 there is no way to disable Ctrl+Q shortcut by plugin on Linux (see this bug). All workarounds I've found are based on setting the global Ctrl+Q shortcut to "steal" it from Firefox. But this will disable this shortcut in every application, and I want to disable this shortcut only in Firefox, without affecting any other app.



Is there a way to disable or catch shortcut only for one application? I'm using Ubuntu with Unity.







linux firefox keyboard-shortcuts ubuntu-unity






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 29 at 20:57









rob006

23918




23918












  • Interesting question, but the answer may depend on the use case. Accidental key presses? Kiosk mode?
    – l0b0
    Apr 29 at 21:13






  • 2




    @l0b0 Accidental key presses. This is regular PC, nothing fancy.
    – rob006
    Apr 29 at 21:14










  • In that case, do you have more details? I'm just checking if there is some way the system can be set up to Do What You Want™, such as save the tabs when you quit, to avoid something which I suspect will be a brittle hack.
    – l0b0
    Apr 29 at 21:46






  • 4




    @l0b0 I want to prevent closing browser by accidental key presses. There is a too many things are changing after closing browser (closing sessions, terminating connections), I would prefer to prevent closing browser than fixing its effects.
    – rob006
    Apr 29 at 22:30






  • 1




    Disabling Ctrl+Q for Firefox on Linux will have to be a brittle hack unless Mozilla does something about it.
    – dsstorefile1
    Apr 29 at 22:46


















  • Interesting question, but the answer may depend on the use case. Accidental key presses? Kiosk mode?
    – l0b0
    Apr 29 at 21:13






  • 2




    @l0b0 Accidental key presses. This is regular PC, nothing fancy.
    – rob006
    Apr 29 at 21:14










  • In that case, do you have more details? I'm just checking if there is some way the system can be set up to Do What You Want™, such as save the tabs when you quit, to avoid something which I suspect will be a brittle hack.
    – l0b0
    Apr 29 at 21:46






  • 4




    @l0b0 I want to prevent closing browser by accidental key presses. There is a too many things are changing after closing browser (closing sessions, terminating connections), I would prefer to prevent closing browser than fixing its effects.
    – rob006
    Apr 29 at 22:30






  • 1




    Disabling Ctrl+Q for Firefox on Linux will have to be a brittle hack unless Mozilla does something about it.
    – dsstorefile1
    Apr 29 at 22:46
















Interesting question, but the answer may depend on the use case. Accidental key presses? Kiosk mode?
– l0b0
Apr 29 at 21:13




Interesting question, but the answer may depend on the use case. Accidental key presses? Kiosk mode?
– l0b0
Apr 29 at 21:13




2




2




@l0b0 Accidental key presses. This is regular PC, nothing fancy.
– rob006
Apr 29 at 21:14




@l0b0 Accidental key presses. This is regular PC, nothing fancy.
– rob006
Apr 29 at 21:14












In that case, do you have more details? I'm just checking if there is some way the system can be set up to Do What You Want™, such as save the tabs when you quit, to avoid something which I suspect will be a brittle hack.
– l0b0
Apr 29 at 21:46




In that case, do you have more details? I'm just checking if there is some way the system can be set up to Do What You Want™, such as save the tabs when you quit, to avoid something which I suspect will be a brittle hack.
– l0b0
Apr 29 at 21:46




4




4




@l0b0 I want to prevent closing browser by accidental key presses. There is a too many things are changing after closing browser (closing sessions, terminating connections), I would prefer to prevent closing browser than fixing its effects.
– rob006
Apr 29 at 22:30




@l0b0 I want to prevent closing browser by accidental key presses. There is a too many things are changing after closing browser (closing sessions, terminating connections), I would prefer to prevent closing browser than fixing its effects.
– rob006
Apr 29 at 22:30




1




1




Disabling Ctrl+Q for Firefox on Linux will have to be a brittle hack unless Mozilla does something about it.
– dsstorefile1
Apr 29 at 22:46




Disabling Ctrl+Q for Firefox on Linux will have to be a brittle hack unless Mozilla does something about it.
– dsstorefile1
Apr 29 at 22:46










5 Answers
5






active

oldest

votes

















up vote
10
down vote













tl/dr: assign a global shortcut to Ctrl-Q



In Firefox Quantum, the about:config settings that used to warn against Firefox closures via an accidental Ctrl-Q keypress no longer work.



Workaround: on Arch Linux | XFCE desktop environment (other Linux distros &/or desktops may allow a similar approach):




  • Whiskers menu >> All Settings >> Keyboard >> Application Shortcuts >> Add



  • Add a new "application", null; assign it to the Ctrl-Q keypress




    • Update (comment by @justderb): "Using 'true' instead of 'null' is nice if you don't want the error window to pop up."




Firefox - 'disable' Ctrl-Q



Invocation: here, I pressed Ctrl-Q in Firefox Quantum v. 60.0.1 (64-bit); instead of quitting Firefox, I get this popup,



Firefox - Ctrl-Q 'disabled'



Caveat: this, of course, globally affects all Ctrl-Q keypresses. However, -- per my own preference -- that shortcoming is outweighed by nullifying those accidental Firefox Ctrl-Q closures (after which I must re-login into websites: GitHub; reddit; ...).



Update



@crazypyro 's answer also works for me (FF Quantum 63.0 on x86_64 Linux) giving a popup warning if you try to Quit Firefox. That should be probably regarded as the specific answer, with my solution as a more general workaround.



about:config (both of the following set to true):




  • browser.showQuitWarning

  • browser.warnOnQuit






share|improve this answer



















  • 6




    Using true instead of null is nice if you don't want the error window to pop up.
    – justderb
    Aug 20 at 19:59










  • @justderb: nice! :-D
    – Victoria Stuart
    Sep 18 at 2:29






  • 1




    for me in archlinux/kde 5 plasma I could not do global shortcut without choosing an application first - could not be true|null, but thanks to your suggestion i was able to remapped it to toggle microphone - which on work computer is pointless for me anyway.. thanks!
    – JTC
    Oct 8 at 11:35


















up vote
6
down vote













At least for me in FF 61.0.2 on 64bit Linux, enabling browser.showQuitWarning (in addition to browser.warnOnQuit) in about:config solves this whole problem.



(I came to this question because I was having the problem by default. But before trying all the cool creative hacks here, I thought I'd just give about:config a try first...)






share|improve this answer

















  • 1




    Any constructive feedback with that downvote?
    – CrazyPyro
    Sep 13 at 17:05






  • 1




    Thanks, works for me at least on FF 62.0.3 (64-Bit Ubuntu).
    – Pont
    Oct 8 at 20:51












  • thank you. This is smart solution, without touching anything.
    – luca76
    Oct 15 at 9:25










  • ^ This is the right answer!
    – Ole Tange
    Oct 19 at 17:07






  • 1




    That doesn't work along with "Restore Previous Session" or "Show my windows and tabs from last time", which is even worse.
    – chefarov
    Nov 6 at 10:02


















up vote
2
down vote



accepted










I was able get what I need with AutoKey. After installation I created empty script with assigned Ctrl+Q as "Hotkey" and .*Firefox as "Window filter".



enter image description here



Then in AutoKey preferences I added it to autostart and disabled notification icon, so it becomes transparent for me.



enter image description here



I used it for a few hours and it looks promising - no false-positives or missed catches so far. Right now Ctrl+Q does not working for Firefox, but it works perfectly fine in PhpStorm for example.





In addition bug 1215061 gives some hope that this will be easier in future and Firefox will finally get some decent keyboard shortcuts settings.






share|improve this answer




























    up vote
    2
    down vote













    Disable Ctrl+q with userChrome.js in Firefox Quantum



    This can be accomplished without an external application by a tiny bit of javascript in your Firefox profile.



    As a prerequisite, you must enable userChrome.js (see below, or obtain from the original GitHub repo)



    After copying the chrome directory and its contents into your user profile, create a file <profile-dir>/chrome/disable_ctrl_q.uc.js with the following content:



    var kqa = document.getElementById('key_quitApplication');
    if (kqa) kqa.remove();


    Lastly, restart Firefox, and ctrl+q will no longer cause the application to exit.





    Enabling userChrome.js in Firefox Quantum



    For completeness, below are the full contents of the modified chrome files. To enable userChrome javascript, create these two files inside a chrome directory within your Firefox profile.




    1. Type about:support in the address bar.

    2. Under Application Basics > Profile Directory click the Open Directory button to open your Firefox profile directory.

    3. Within the profile directory, make a new directory called chrome

    4. Within the chrome directory, create new files userChrome.css and userChrome.xml with the contents listed below.

    5. Restart Firefox (you probably also want to create the .uc.js file above if you're following these steps to disable ctrl+q)


    userChrome.css



    /* Copyright (c) 2017 Haggai Nuchi
    Available for use under the MIT License:
    https://opensource.org/licenses/MIT
    */
    @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
    toolbarbutton#alltabs-button {
    -moz-binding: url("userChrome.xml#js");
    }


    userChrome.xml



    <?xml version="1.0"?>
    <!-- Copyright (c) 2017 Haggai Nuchi
    Available for use under the MIT License:
    https://opensource.org/licenses/MIT
    -->

    <bindings id="generalBindings"
    xmlns="http://www.mozilla.org/xbl"
    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    xmlns:xbl="http://www.mozilla.org/xbl">

    <binding id="js" extends="chrome://global/content/bindings/toolbarbutton.xml#menu">
    <implementation>
    <constructor><![CDATA[
    function makeRelativePathURI(name) {
    let absolutePath = Components.stack.filename;
    return absolutePath.substring(0, absolutePath.lastIndexOf("/") + 1) + name;
    }
    // The following code executes in the browser context,
    // i.e. chrome://browser/content/browser.xul
    Services.scriptloader.loadSubScript(makeRelativePathURI("userChrome.js"), window);
    ]]></constructor>
    </implementation>
    </binding>
    </bindings>





    share|improve this answer























    • This doesn't work in Firefox 62
      – Grief
      Aug 16 at 10:54








    • 1




      It works with the latest stable, Firefox 61. Hopefully 62 is fixed before it leaves beta.
      – thinkmassive
      Aug 16 at 16:40


















    up vote
    0
    down vote













    An ugly, but simple and effective workaround is always keeping a page open that has an active onbeforeunload handler, i.e. will trigger the "This page is asking you to confirm that you want to leave - data you have entered may not be saved." dialog when you attempt to close it.



    That way, if you accidentally try to CTRL+Q, you will receive that dialog, and can choose "stay on this page" to cancel the exit.






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1318336%2fhow-to-disable-ctrlq-shortcut-in-firefox-on-linux%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      10
      down vote













      tl/dr: assign a global shortcut to Ctrl-Q



      In Firefox Quantum, the about:config settings that used to warn against Firefox closures via an accidental Ctrl-Q keypress no longer work.



      Workaround: on Arch Linux | XFCE desktop environment (other Linux distros &/or desktops may allow a similar approach):




      • Whiskers menu >> All Settings >> Keyboard >> Application Shortcuts >> Add



      • Add a new "application", null; assign it to the Ctrl-Q keypress




        • Update (comment by @justderb): "Using 'true' instead of 'null' is nice if you don't want the error window to pop up."




      Firefox - 'disable' Ctrl-Q



      Invocation: here, I pressed Ctrl-Q in Firefox Quantum v. 60.0.1 (64-bit); instead of quitting Firefox, I get this popup,



      Firefox - Ctrl-Q 'disabled'



      Caveat: this, of course, globally affects all Ctrl-Q keypresses. However, -- per my own preference -- that shortcoming is outweighed by nullifying those accidental Firefox Ctrl-Q closures (after which I must re-login into websites: GitHub; reddit; ...).



      Update



      @crazypyro 's answer also works for me (FF Quantum 63.0 on x86_64 Linux) giving a popup warning if you try to Quit Firefox. That should be probably regarded as the specific answer, with my solution as a more general workaround.



      about:config (both of the following set to true):




      • browser.showQuitWarning

      • browser.warnOnQuit






      share|improve this answer



















      • 6




        Using true instead of null is nice if you don't want the error window to pop up.
        – justderb
        Aug 20 at 19:59










      • @justderb: nice! :-D
        – Victoria Stuart
        Sep 18 at 2:29






      • 1




        for me in archlinux/kde 5 plasma I could not do global shortcut without choosing an application first - could not be true|null, but thanks to your suggestion i was able to remapped it to toggle microphone - which on work computer is pointless for me anyway.. thanks!
        – JTC
        Oct 8 at 11:35















      up vote
      10
      down vote













      tl/dr: assign a global shortcut to Ctrl-Q



      In Firefox Quantum, the about:config settings that used to warn against Firefox closures via an accidental Ctrl-Q keypress no longer work.



      Workaround: on Arch Linux | XFCE desktop environment (other Linux distros &/or desktops may allow a similar approach):




      • Whiskers menu >> All Settings >> Keyboard >> Application Shortcuts >> Add



      • Add a new "application", null; assign it to the Ctrl-Q keypress




        • Update (comment by @justderb): "Using 'true' instead of 'null' is nice if you don't want the error window to pop up."




      Firefox - 'disable' Ctrl-Q



      Invocation: here, I pressed Ctrl-Q in Firefox Quantum v. 60.0.1 (64-bit); instead of quitting Firefox, I get this popup,



      Firefox - Ctrl-Q 'disabled'



      Caveat: this, of course, globally affects all Ctrl-Q keypresses. However, -- per my own preference -- that shortcoming is outweighed by nullifying those accidental Firefox Ctrl-Q closures (after which I must re-login into websites: GitHub; reddit; ...).



      Update



      @crazypyro 's answer also works for me (FF Quantum 63.0 on x86_64 Linux) giving a popup warning if you try to Quit Firefox. That should be probably regarded as the specific answer, with my solution as a more general workaround.



      about:config (both of the following set to true):




      • browser.showQuitWarning

      • browser.warnOnQuit






      share|improve this answer



















      • 6




        Using true instead of null is nice if you don't want the error window to pop up.
        – justderb
        Aug 20 at 19:59










      • @justderb: nice! :-D
        – Victoria Stuart
        Sep 18 at 2:29






      • 1




        for me in archlinux/kde 5 plasma I could not do global shortcut without choosing an application first - could not be true|null, but thanks to your suggestion i was able to remapped it to toggle microphone - which on work computer is pointless for me anyway.. thanks!
        – JTC
        Oct 8 at 11:35













      up vote
      10
      down vote










      up vote
      10
      down vote









      tl/dr: assign a global shortcut to Ctrl-Q



      In Firefox Quantum, the about:config settings that used to warn against Firefox closures via an accidental Ctrl-Q keypress no longer work.



      Workaround: on Arch Linux | XFCE desktop environment (other Linux distros &/or desktops may allow a similar approach):




      • Whiskers menu >> All Settings >> Keyboard >> Application Shortcuts >> Add



      • Add a new "application", null; assign it to the Ctrl-Q keypress




        • Update (comment by @justderb): "Using 'true' instead of 'null' is nice if you don't want the error window to pop up."




      Firefox - 'disable' Ctrl-Q



      Invocation: here, I pressed Ctrl-Q in Firefox Quantum v. 60.0.1 (64-bit); instead of quitting Firefox, I get this popup,



      Firefox - Ctrl-Q 'disabled'



      Caveat: this, of course, globally affects all Ctrl-Q keypresses. However, -- per my own preference -- that shortcoming is outweighed by nullifying those accidental Firefox Ctrl-Q closures (after which I must re-login into websites: GitHub; reddit; ...).



      Update



      @crazypyro 's answer also works for me (FF Quantum 63.0 on x86_64 Linux) giving a popup warning if you try to Quit Firefox. That should be probably regarded as the specific answer, with my solution as a more general workaround.



      about:config (both of the following set to true):




      • browser.showQuitWarning

      • browser.warnOnQuit






      share|improve this answer














      tl/dr: assign a global shortcut to Ctrl-Q



      In Firefox Quantum, the about:config settings that used to warn against Firefox closures via an accidental Ctrl-Q keypress no longer work.



      Workaround: on Arch Linux | XFCE desktop environment (other Linux distros &/or desktops may allow a similar approach):




      • Whiskers menu >> All Settings >> Keyboard >> Application Shortcuts >> Add



      • Add a new "application", null; assign it to the Ctrl-Q keypress




        • Update (comment by @justderb): "Using 'true' instead of 'null' is nice if you don't want the error window to pop up."




      Firefox - 'disable' Ctrl-Q



      Invocation: here, I pressed Ctrl-Q in Firefox Quantum v. 60.0.1 (64-bit); instead of quitting Firefox, I get this popup,



      Firefox - Ctrl-Q 'disabled'



      Caveat: this, of course, globally affects all Ctrl-Q keypresses. However, -- per my own preference -- that shortcoming is outweighed by nullifying those accidental Firefox Ctrl-Q closures (after which I must re-login into websites: GitHub; reddit; ...).



      Update



      @crazypyro 's answer also works for me (FF Quantum 63.0 on x86_64 Linux) giving a popup warning if you try to Quit Firefox. That should be probably regarded as the specific answer, with my solution as a more general workaround.



      about:config (both of the following set to true):




      • browser.showQuitWarning

      • browser.warnOnQuit







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Dec 5 at 19:36

























      answered Jun 3 at 22:14









      Victoria Stuart

      22315




      22315








      • 6




        Using true instead of null is nice if you don't want the error window to pop up.
        – justderb
        Aug 20 at 19:59










      • @justderb: nice! :-D
        – Victoria Stuart
        Sep 18 at 2:29






      • 1




        for me in archlinux/kde 5 plasma I could not do global shortcut without choosing an application first - could not be true|null, but thanks to your suggestion i was able to remapped it to toggle microphone - which on work computer is pointless for me anyway.. thanks!
        – JTC
        Oct 8 at 11:35














      • 6




        Using true instead of null is nice if you don't want the error window to pop up.
        – justderb
        Aug 20 at 19:59










      • @justderb: nice! :-D
        – Victoria Stuart
        Sep 18 at 2:29






      • 1




        for me in archlinux/kde 5 plasma I could not do global shortcut without choosing an application first - could not be true|null, but thanks to your suggestion i was able to remapped it to toggle microphone - which on work computer is pointless for me anyway.. thanks!
        – JTC
        Oct 8 at 11:35








      6




      6




      Using true instead of null is nice if you don't want the error window to pop up.
      – justderb
      Aug 20 at 19:59




      Using true instead of null is nice if you don't want the error window to pop up.
      – justderb
      Aug 20 at 19:59












      @justderb: nice! :-D
      – Victoria Stuart
      Sep 18 at 2:29




      @justderb: nice! :-D
      – Victoria Stuart
      Sep 18 at 2:29




      1




      1




      for me in archlinux/kde 5 plasma I could not do global shortcut without choosing an application first - could not be true|null, but thanks to your suggestion i was able to remapped it to toggle microphone - which on work computer is pointless for me anyway.. thanks!
      – JTC
      Oct 8 at 11:35




      for me in archlinux/kde 5 plasma I could not do global shortcut without choosing an application first - could not be true|null, but thanks to your suggestion i was able to remapped it to toggle microphone - which on work computer is pointless for me anyway.. thanks!
      – JTC
      Oct 8 at 11:35












      up vote
      6
      down vote













      At least for me in FF 61.0.2 on 64bit Linux, enabling browser.showQuitWarning (in addition to browser.warnOnQuit) in about:config solves this whole problem.



      (I came to this question because I was having the problem by default. But before trying all the cool creative hacks here, I thought I'd just give about:config a try first...)






      share|improve this answer

















      • 1




        Any constructive feedback with that downvote?
        – CrazyPyro
        Sep 13 at 17:05






      • 1




        Thanks, works for me at least on FF 62.0.3 (64-Bit Ubuntu).
        – Pont
        Oct 8 at 20:51












      • thank you. This is smart solution, without touching anything.
        – luca76
        Oct 15 at 9:25










      • ^ This is the right answer!
        – Ole Tange
        Oct 19 at 17:07






      • 1




        That doesn't work along with "Restore Previous Session" or "Show my windows and tabs from last time", which is even worse.
        – chefarov
        Nov 6 at 10:02















      up vote
      6
      down vote













      At least for me in FF 61.0.2 on 64bit Linux, enabling browser.showQuitWarning (in addition to browser.warnOnQuit) in about:config solves this whole problem.



      (I came to this question because I was having the problem by default. But before trying all the cool creative hacks here, I thought I'd just give about:config a try first...)






      share|improve this answer

















      • 1




        Any constructive feedback with that downvote?
        – CrazyPyro
        Sep 13 at 17:05






      • 1




        Thanks, works for me at least on FF 62.0.3 (64-Bit Ubuntu).
        – Pont
        Oct 8 at 20:51












      • thank you. This is smart solution, without touching anything.
        – luca76
        Oct 15 at 9:25










      • ^ This is the right answer!
        – Ole Tange
        Oct 19 at 17:07






      • 1




        That doesn't work along with "Restore Previous Session" or "Show my windows and tabs from last time", which is even worse.
        – chefarov
        Nov 6 at 10:02













      up vote
      6
      down vote










      up vote
      6
      down vote









      At least for me in FF 61.0.2 on 64bit Linux, enabling browser.showQuitWarning (in addition to browser.warnOnQuit) in about:config solves this whole problem.



      (I came to this question because I was having the problem by default. But before trying all the cool creative hacks here, I thought I'd just give about:config a try first...)






      share|improve this answer












      At least for me in FF 61.0.2 on 64bit Linux, enabling browser.showQuitWarning (in addition to browser.warnOnQuit) in about:config solves this whole problem.



      (I came to this question because I was having the problem by default. But before trying all the cool creative hacks here, I thought I'd just give about:config a try first...)







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Aug 25 at 19:50









      CrazyPyro

      24934




      24934








      • 1




        Any constructive feedback with that downvote?
        – CrazyPyro
        Sep 13 at 17:05






      • 1




        Thanks, works for me at least on FF 62.0.3 (64-Bit Ubuntu).
        – Pont
        Oct 8 at 20:51












      • thank you. This is smart solution, without touching anything.
        – luca76
        Oct 15 at 9:25










      • ^ This is the right answer!
        – Ole Tange
        Oct 19 at 17:07






      • 1




        That doesn't work along with "Restore Previous Session" or "Show my windows and tabs from last time", which is even worse.
        – chefarov
        Nov 6 at 10:02














      • 1




        Any constructive feedback with that downvote?
        – CrazyPyro
        Sep 13 at 17:05






      • 1




        Thanks, works for me at least on FF 62.0.3 (64-Bit Ubuntu).
        – Pont
        Oct 8 at 20:51












      • thank you. This is smart solution, without touching anything.
        – luca76
        Oct 15 at 9:25










      • ^ This is the right answer!
        – Ole Tange
        Oct 19 at 17:07






      • 1




        That doesn't work along with "Restore Previous Session" or "Show my windows and tabs from last time", which is even worse.
        – chefarov
        Nov 6 at 10:02








      1




      1




      Any constructive feedback with that downvote?
      – CrazyPyro
      Sep 13 at 17:05




      Any constructive feedback with that downvote?
      – CrazyPyro
      Sep 13 at 17:05




      1




      1




      Thanks, works for me at least on FF 62.0.3 (64-Bit Ubuntu).
      – Pont
      Oct 8 at 20:51






      Thanks, works for me at least on FF 62.0.3 (64-Bit Ubuntu).
      – Pont
      Oct 8 at 20:51














      thank you. This is smart solution, without touching anything.
      – luca76
      Oct 15 at 9:25




      thank you. This is smart solution, without touching anything.
      – luca76
      Oct 15 at 9:25












      ^ This is the right answer!
      – Ole Tange
      Oct 19 at 17:07




      ^ This is the right answer!
      – Ole Tange
      Oct 19 at 17:07




      1




      1




      That doesn't work along with "Restore Previous Session" or "Show my windows and tabs from last time", which is even worse.
      – chefarov
      Nov 6 at 10:02




      That doesn't work along with "Restore Previous Session" or "Show my windows and tabs from last time", which is even worse.
      – chefarov
      Nov 6 at 10:02










      up vote
      2
      down vote



      accepted










      I was able get what I need with AutoKey. After installation I created empty script with assigned Ctrl+Q as "Hotkey" and .*Firefox as "Window filter".



      enter image description here



      Then in AutoKey preferences I added it to autostart and disabled notification icon, so it becomes transparent for me.



      enter image description here



      I used it for a few hours and it looks promising - no false-positives or missed catches so far. Right now Ctrl+Q does not working for Firefox, but it works perfectly fine in PhpStorm for example.





      In addition bug 1215061 gives some hope that this will be easier in future and Firefox will finally get some decent keyboard shortcuts settings.






      share|improve this answer

























        up vote
        2
        down vote



        accepted










        I was able get what I need with AutoKey. After installation I created empty script with assigned Ctrl+Q as "Hotkey" and .*Firefox as "Window filter".



        enter image description here



        Then in AutoKey preferences I added it to autostart and disabled notification icon, so it becomes transparent for me.



        enter image description here



        I used it for a few hours and it looks promising - no false-positives or missed catches so far. Right now Ctrl+Q does not working for Firefox, but it works perfectly fine in PhpStorm for example.





        In addition bug 1215061 gives some hope that this will be easier in future and Firefox will finally get some decent keyboard shortcuts settings.






        share|improve this answer























          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          I was able get what I need with AutoKey. After installation I created empty script with assigned Ctrl+Q as "Hotkey" and .*Firefox as "Window filter".



          enter image description here



          Then in AutoKey preferences I added it to autostart and disabled notification icon, so it becomes transparent for me.



          enter image description here



          I used it for a few hours and it looks promising - no false-positives or missed catches so far. Right now Ctrl+Q does not working for Firefox, but it works perfectly fine in PhpStorm for example.





          In addition bug 1215061 gives some hope that this will be easier in future and Firefox will finally get some decent keyboard shortcuts settings.






          share|improve this answer












          I was able get what I need with AutoKey. After installation I created empty script with assigned Ctrl+Q as "Hotkey" and .*Firefox as "Window filter".



          enter image description here



          Then in AutoKey preferences I added it to autostart and disabled notification icon, so it becomes transparent for me.



          enter image description here



          I used it for a few hours and it looks promising - no false-positives or missed catches so far. Right now Ctrl+Q does not working for Firefox, but it works perfectly fine in PhpStorm for example.





          In addition bug 1215061 gives some hope that this will be easier in future and Firefox will finally get some decent keyboard shortcuts settings.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 30 at 9:09









          rob006

          23918




          23918






















              up vote
              2
              down vote













              Disable Ctrl+q with userChrome.js in Firefox Quantum



              This can be accomplished without an external application by a tiny bit of javascript in your Firefox profile.



              As a prerequisite, you must enable userChrome.js (see below, or obtain from the original GitHub repo)



              After copying the chrome directory and its contents into your user profile, create a file <profile-dir>/chrome/disable_ctrl_q.uc.js with the following content:



              var kqa = document.getElementById('key_quitApplication');
              if (kqa) kqa.remove();


              Lastly, restart Firefox, and ctrl+q will no longer cause the application to exit.





              Enabling userChrome.js in Firefox Quantum



              For completeness, below are the full contents of the modified chrome files. To enable userChrome javascript, create these two files inside a chrome directory within your Firefox profile.




              1. Type about:support in the address bar.

              2. Under Application Basics > Profile Directory click the Open Directory button to open your Firefox profile directory.

              3. Within the profile directory, make a new directory called chrome

              4. Within the chrome directory, create new files userChrome.css and userChrome.xml with the contents listed below.

              5. Restart Firefox (you probably also want to create the .uc.js file above if you're following these steps to disable ctrl+q)


              userChrome.css



              /* Copyright (c) 2017 Haggai Nuchi
              Available for use under the MIT License:
              https://opensource.org/licenses/MIT
              */
              @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
              toolbarbutton#alltabs-button {
              -moz-binding: url("userChrome.xml#js");
              }


              userChrome.xml



              <?xml version="1.0"?>
              <!-- Copyright (c) 2017 Haggai Nuchi
              Available for use under the MIT License:
              https://opensource.org/licenses/MIT
              -->

              <bindings id="generalBindings"
              xmlns="http://www.mozilla.org/xbl"
              xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
              xmlns:xbl="http://www.mozilla.org/xbl">

              <binding id="js" extends="chrome://global/content/bindings/toolbarbutton.xml#menu">
              <implementation>
              <constructor><![CDATA[
              function makeRelativePathURI(name) {
              let absolutePath = Components.stack.filename;
              return absolutePath.substring(0, absolutePath.lastIndexOf("/") + 1) + name;
              }
              // The following code executes in the browser context,
              // i.e. chrome://browser/content/browser.xul
              Services.scriptloader.loadSubScript(makeRelativePathURI("userChrome.js"), window);
              ]]></constructor>
              </implementation>
              </binding>
              </bindings>





              share|improve this answer























              • This doesn't work in Firefox 62
                – Grief
                Aug 16 at 10:54








              • 1




                It works with the latest stable, Firefox 61. Hopefully 62 is fixed before it leaves beta.
                – thinkmassive
                Aug 16 at 16:40















              up vote
              2
              down vote













              Disable Ctrl+q with userChrome.js in Firefox Quantum



              This can be accomplished without an external application by a tiny bit of javascript in your Firefox profile.



              As a prerequisite, you must enable userChrome.js (see below, or obtain from the original GitHub repo)



              After copying the chrome directory and its contents into your user profile, create a file <profile-dir>/chrome/disable_ctrl_q.uc.js with the following content:



              var kqa = document.getElementById('key_quitApplication');
              if (kqa) kqa.remove();


              Lastly, restart Firefox, and ctrl+q will no longer cause the application to exit.





              Enabling userChrome.js in Firefox Quantum



              For completeness, below are the full contents of the modified chrome files. To enable userChrome javascript, create these two files inside a chrome directory within your Firefox profile.




              1. Type about:support in the address bar.

              2. Under Application Basics > Profile Directory click the Open Directory button to open your Firefox profile directory.

              3. Within the profile directory, make a new directory called chrome

              4. Within the chrome directory, create new files userChrome.css and userChrome.xml with the contents listed below.

              5. Restart Firefox (you probably also want to create the .uc.js file above if you're following these steps to disable ctrl+q)


              userChrome.css



              /* Copyright (c) 2017 Haggai Nuchi
              Available for use under the MIT License:
              https://opensource.org/licenses/MIT
              */
              @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
              toolbarbutton#alltabs-button {
              -moz-binding: url("userChrome.xml#js");
              }


              userChrome.xml



              <?xml version="1.0"?>
              <!-- Copyright (c) 2017 Haggai Nuchi
              Available for use under the MIT License:
              https://opensource.org/licenses/MIT
              -->

              <bindings id="generalBindings"
              xmlns="http://www.mozilla.org/xbl"
              xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
              xmlns:xbl="http://www.mozilla.org/xbl">

              <binding id="js" extends="chrome://global/content/bindings/toolbarbutton.xml#menu">
              <implementation>
              <constructor><![CDATA[
              function makeRelativePathURI(name) {
              let absolutePath = Components.stack.filename;
              return absolutePath.substring(0, absolutePath.lastIndexOf("/") + 1) + name;
              }
              // The following code executes in the browser context,
              // i.e. chrome://browser/content/browser.xul
              Services.scriptloader.loadSubScript(makeRelativePathURI("userChrome.js"), window);
              ]]></constructor>
              </implementation>
              </binding>
              </bindings>





              share|improve this answer























              • This doesn't work in Firefox 62
                – Grief
                Aug 16 at 10:54








              • 1




                It works with the latest stable, Firefox 61. Hopefully 62 is fixed before it leaves beta.
                – thinkmassive
                Aug 16 at 16:40













              up vote
              2
              down vote










              up vote
              2
              down vote









              Disable Ctrl+q with userChrome.js in Firefox Quantum



              This can be accomplished without an external application by a tiny bit of javascript in your Firefox profile.



              As a prerequisite, you must enable userChrome.js (see below, or obtain from the original GitHub repo)



              After copying the chrome directory and its contents into your user profile, create a file <profile-dir>/chrome/disable_ctrl_q.uc.js with the following content:



              var kqa = document.getElementById('key_quitApplication');
              if (kqa) kqa.remove();


              Lastly, restart Firefox, and ctrl+q will no longer cause the application to exit.





              Enabling userChrome.js in Firefox Quantum



              For completeness, below are the full contents of the modified chrome files. To enable userChrome javascript, create these two files inside a chrome directory within your Firefox profile.




              1. Type about:support in the address bar.

              2. Under Application Basics > Profile Directory click the Open Directory button to open your Firefox profile directory.

              3. Within the profile directory, make a new directory called chrome

              4. Within the chrome directory, create new files userChrome.css and userChrome.xml with the contents listed below.

              5. Restart Firefox (you probably also want to create the .uc.js file above if you're following these steps to disable ctrl+q)


              userChrome.css



              /* Copyright (c) 2017 Haggai Nuchi
              Available for use under the MIT License:
              https://opensource.org/licenses/MIT
              */
              @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
              toolbarbutton#alltabs-button {
              -moz-binding: url("userChrome.xml#js");
              }


              userChrome.xml



              <?xml version="1.0"?>
              <!-- Copyright (c) 2017 Haggai Nuchi
              Available for use under the MIT License:
              https://opensource.org/licenses/MIT
              -->

              <bindings id="generalBindings"
              xmlns="http://www.mozilla.org/xbl"
              xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
              xmlns:xbl="http://www.mozilla.org/xbl">

              <binding id="js" extends="chrome://global/content/bindings/toolbarbutton.xml#menu">
              <implementation>
              <constructor><![CDATA[
              function makeRelativePathURI(name) {
              let absolutePath = Components.stack.filename;
              return absolutePath.substring(0, absolutePath.lastIndexOf("/") + 1) + name;
              }
              // The following code executes in the browser context,
              // i.e. chrome://browser/content/browser.xul
              Services.scriptloader.loadSubScript(makeRelativePathURI("userChrome.js"), window);
              ]]></constructor>
              </implementation>
              </binding>
              </bindings>





              share|improve this answer














              Disable Ctrl+q with userChrome.js in Firefox Quantum



              This can be accomplished without an external application by a tiny bit of javascript in your Firefox profile.



              As a prerequisite, you must enable userChrome.js (see below, or obtain from the original GitHub repo)



              After copying the chrome directory and its contents into your user profile, create a file <profile-dir>/chrome/disable_ctrl_q.uc.js with the following content:



              var kqa = document.getElementById('key_quitApplication');
              if (kqa) kqa.remove();


              Lastly, restart Firefox, and ctrl+q will no longer cause the application to exit.





              Enabling userChrome.js in Firefox Quantum



              For completeness, below are the full contents of the modified chrome files. To enable userChrome javascript, create these two files inside a chrome directory within your Firefox profile.




              1. Type about:support in the address bar.

              2. Under Application Basics > Profile Directory click the Open Directory button to open your Firefox profile directory.

              3. Within the profile directory, make a new directory called chrome

              4. Within the chrome directory, create new files userChrome.css and userChrome.xml with the contents listed below.

              5. Restart Firefox (you probably also want to create the .uc.js file above if you're following these steps to disable ctrl+q)


              userChrome.css



              /* Copyright (c) 2017 Haggai Nuchi
              Available for use under the MIT License:
              https://opensource.org/licenses/MIT
              */
              @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
              toolbarbutton#alltabs-button {
              -moz-binding: url("userChrome.xml#js");
              }


              userChrome.xml



              <?xml version="1.0"?>
              <!-- Copyright (c) 2017 Haggai Nuchi
              Available for use under the MIT License:
              https://opensource.org/licenses/MIT
              -->

              <bindings id="generalBindings"
              xmlns="http://www.mozilla.org/xbl"
              xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
              xmlns:xbl="http://www.mozilla.org/xbl">

              <binding id="js" extends="chrome://global/content/bindings/toolbarbutton.xml#menu">
              <implementation>
              <constructor><![CDATA[
              function makeRelativePathURI(name) {
              let absolutePath = Components.stack.filename;
              return absolutePath.substring(0, absolutePath.lastIndexOf("/") + 1) + name;
              }
              // The following code executes in the browser context,
              // i.e. chrome://browser/content/browser.xul
              Services.scriptloader.loadSubScript(makeRelativePathURI("userChrome.js"), window);
              ]]></constructor>
              </implementation>
              </binding>
              </bindings>






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Aug 11 at 4:20

























              answered Aug 11 at 4:02









              thinkmassive

              1948




              1948












              • This doesn't work in Firefox 62
                – Grief
                Aug 16 at 10:54








              • 1




                It works with the latest stable, Firefox 61. Hopefully 62 is fixed before it leaves beta.
                – thinkmassive
                Aug 16 at 16:40


















              • This doesn't work in Firefox 62
                – Grief
                Aug 16 at 10:54








              • 1




                It works with the latest stable, Firefox 61. Hopefully 62 is fixed before it leaves beta.
                – thinkmassive
                Aug 16 at 16:40
















              This doesn't work in Firefox 62
              – Grief
              Aug 16 at 10:54






              This doesn't work in Firefox 62
              – Grief
              Aug 16 at 10:54






              1




              1




              It works with the latest stable, Firefox 61. Hopefully 62 is fixed before it leaves beta.
              – thinkmassive
              Aug 16 at 16:40




              It works with the latest stable, Firefox 61. Hopefully 62 is fixed before it leaves beta.
              – thinkmassive
              Aug 16 at 16:40










              up vote
              0
              down vote













              An ugly, but simple and effective workaround is always keeping a page open that has an active onbeforeunload handler, i.e. will trigger the "This page is asking you to confirm that you want to leave - data you have entered may not be saved." dialog when you attempt to close it.



              That way, if you accidentally try to CTRL+Q, you will receive that dialog, and can choose "stay on this page" to cancel the exit.






              share|improve this answer

























                up vote
                0
                down vote













                An ugly, but simple and effective workaround is always keeping a page open that has an active onbeforeunload handler, i.e. will trigger the "This page is asking you to confirm that you want to leave - data you have entered may not be saved." dialog when you attempt to close it.



                That way, if you accidentally try to CTRL+Q, you will receive that dialog, and can choose "stay on this page" to cancel the exit.






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  An ugly, but simple and effective workaround is always keeping a page open that has an active onbeforeunload handler, i.e. will trigger the "This page is asking you to confirm that you want to leave - data you have entered may not be saved." dialog when you attempt to close it.



                  That way, if you accidentally try to CTRL+Q, you will receive that dialog, and can choose "stay on this page" to cancel the exit.






                  share|improve this answer












                  An ugly, but simple and effective workaround is always keeping a page open that has an active onbeforeunload handler, i.e. will trigger the "This page is asking you to confirm that you want to leave - data you have entered may not be saved." dialog when you attempt to close it.



                  That way, if you accidentally try to CTRL+Q, you will receive that dialog, and can choose "stay on this page" to cancel the exit.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 8 at 1:14









                  Jan Schejbal

                  834514




                  834514






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1318336%2fhow-to-disable-ctrlq-shortcut-in-firefox-on-linux%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Mouse cursor on multiple screens with different PPI

                      Agildo Ribeiro

                      Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”