Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Mulongo oyo etiyamaki na archive. Tuna motuna mosusu soki osengeli na lisalisi

Disabling Control +w keybind

  • 6 biyano
  • 1 eza na nkokoso oyo
  • 1 view
  • Eyano yasuka ya wtfiwinomgs

more options

Could you add a option of closing tab with <kbd>Ctrl</kbd>+<kbd>w</kbd> to the advanced preference?

Also, I realized that:

```browser.tabs.warnOnClose False``` Does this option activates warn when closing the tab? If your answer is yes, it is not working at all.

Could you add a option of closing tab with <kbd>Ctrl</kbd>+<kbd>w</kbd> to the advanced preference? Also, I realized that: ```browser.tabs.warnOnClose False``` Does this option activates warn when closing the tab? If your answer is yes, it is not working at all.

All Replies (6)

more options

Only closing a window (Ctrl+Shift+W) could possibly make Firefox display a warning, closing a tab is always done without a warning as you can reopen a closed tab via Ctrl+Shift+T.

You can possibly disable the key_close (Ctrl+W) and possibly also key_closeWindow (Ctrl+Shift+W) via an autoconfig.cfg file.

See:

more options

I'm not a js developer could you bear my nobleness? Because created these files but I think skipping something...

According to the this guide,I created two file ones named "autoconfig.js" under /usr/lib/firefox/defaults/pref

The content of the autoconfig.js is:

pref("general.config.filename", "firefox.cfg");                                 
pref("general.config.obscure_value", 0)                                         
                                                                                 
pref("key_close", 0)                                                            
pref("key_closeWindow", 0)                                                      
                                                                                 
unlockPref("pref.general.key_close")                                            
unlockPref("pref.general.key_closeWindow")  

Also provided EL with vim :set ff=unix


another is named firefox.cfg under /usr/lib/firefox/ then content

cat firefox.cfg // IMPORTANT: Start your code on the 2nd line

Also provided EL with vim :set ff=unix for so it's not working.

Ezalaki modifié na maxemilian

more options

You can use the autoconfig.cfg file in the Firefox installation folder to initialize (set/lock) preferences and run privileged JavaScript code.

To use Autoconfig, place two files into the Firefox installation directory.

  • on Windows and Linux, they go into the same directory where Firefox is installed
  • on macOS, they go into the Contents/Resources directory of the Firefox.app

The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults\pref" directory where the channel-prefs.js file is located. The autoconfig.cfg file is placed at the top level of the Firefox directory.

  • autoconfig.cfg and autoconfig.js need to start with a comment line (//)
  • autoconfig.js needs to use Unix line endings (LF instead of CR/LF)

See also:


The content of autoconfig.js:

//
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);

The content of autoconfig.cfg:

let { classes: Cc, interfaces: Ci, manager: Cm  } = Components;
let Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;
function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
ConfigJS.prototype = {
  observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
  handleEvent: function (aEvent) {
    let document = aEvent.originalTarget;
    let window = document.defaultView;
    let location = window.location;
    if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
      if (window._gBrowser) {
        let keys = ["key_close","key_closeWindow"];
        for (var i=0; i < keys.length; i++) {
          let keyCommand = window.document.getElementById(keys[i]);
          if (keyCommand != undefined) { 
            keyCommand.removeAttribute("command"); 
            keyCommand.removeAttribute("key"); 
            keyCommand.removeAttribute("modifiers"); 
            keyCommand.removeAttribute("oncommand"); 
            keyCommand.removeAttribute("data-l10n-id"); 
          }
        }
      }
    }
  }
};
if (!Services.appinfo.inSafeMode) { new ConfigJS(); }

Ezalaki modifié na cor-el

more options

cor-el said

You can use the autoconfig.cfg file in the Firefox installation folder to initialize (set/lock) preferences and run privileged JavaScript code. To use Autoconfig, place two files into the Firefox installation directory.
  • on Windows and Linux, they go into the same directory where Firefox is installed
  • on macOS, they go into the Contents/Resources directory of the Firefox.app
The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults\pref" directory where the channel-prefs.js file is located. The autoconfig.cfg file is placed at the top level of the Firefox directory.
  • autoconfig.cfg and autoconfig.js need to start with a comment line (//)
  • autoconfig.js needs to use Unix line endings (LF instead of CR/LF)
See also:

The content of autoconfig.js:

//
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);

The content of autoconfig.cfg:

let { classes: Cc, interfaces: Ci, manager: Cm  } = Components;
const {Services} = Components.utils.import('resource://gre/modules/Services.jsm');
function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
ConfigJS.prototype = {
  observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
  handleEvent: function (aEvent) {
    let document = aEvent.originalTarget;
    let window = document.defaultView;
    let location = window.location;
    if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
      if (window._gBrowser) {
        let keys = ["key_close","key_closeWindow"];
        for (var i=0; i < keys.length; i++) {
          let keyCommand = window.document.getElementById(keys[i]);
          if (keyCommand != undefined) { 
            keyCommand.removeAttribute("command"); 
            keyCommand.removeAttribute("key"); 
            keyCommand.removeAttribute("modifiers"); 
            keyCommand.removeAttribute("oncommand"); 
            keyCommand.removeAttribute("data-l10n-id"); 
          }
        }
      }
    }
  }
};
if (!Services.appinfo.inSafeMode) { new ConfigJS(); }

thank you very much for this, unfortunately unlike the OP I am looking for something entirely different.

jumping to tabs 1-9 with Ctrl + 1 through 9, how do I disable them? in his case, closing tab term is "key_close" but I am not sure the term for Ctrl + 1-9. Also, how can I go about adding "Ctrl + `" to previous tab rather than Ctrl + Shift + Tab?

please help, thank you.

more options

Hi wtfiwinomgs

That is about the key_selectTab (1-8) IDs and key_selectLastTab (9).

more options

cor-el said

Hi wtfiwinomgs That is about the key_selectTab (1-8) IDs and key_selectLastTab (9).

oh thank you. I did find the xhtml but it looked very confusing.

what about binding a new key to previous tab? as well as binding new key to undo previously closed tab?

in the script is to disable key but how do I bind them?