MozillaZine

Changing the F10 toggle menu shortcut

User Help for Mozilla Firefox
boardtc

User avatar
 
Posts: 199
Joined: November 19th, 2002, 4:55 pm
Location: Ireland

Post Posted April 29th, 2020, 6:47 am

I use F10 to access my own shortcuts and wish to be able to use it in Firefox, where F10 toggles the menu. Alt does the same job nicely. It's been asked before about disabling F10 - https://support.mozilla.org/en-US/questions/1256575 - with no joy. Is there a way to edit the keyboard shortcut to change F10 to something else. Any addon or hack that anyone can recommend?

morat
 
Posts: 3910
Joined: February 3rd, 2009, 6:29 pm

Post Posted April 29th, 2020, 7:45 am

Last edited by morat on April 29th, 2020, 8:55 am, edited 2 times in total.

boardtc

User avatar
 
Posts: 199
Joined: November 19th, 2002, 4:55 pm
Location: Ireland

Post Posted April 29th, 2020, 7:50 am

Thanks for the links. They are 10 years old. Has no one hacked a way to change the shortcut in 10 years?

morat
 
Posts: 3910
Joined: February 3rd, 2009, 6:29 pm

Post Posted April 29th, 2020, 8:58 am

Another post by dorando
http://forums.mozillazine.org/viewtopic.php?p=9643487#p9643487

I can disable F10 using the browser console so maybe you could disable F10 using a mozilla.cfg hack.

Code: Select all
window.addEventListener("keypress", function (event) {
  if (event.keyCode == event.DOM_VK_F10 && !event.shiftKey && !event.altKey && !event.ctrlKey) {
    event.preventDefault();
    event.stopPropagation();
  }
}, true);

Browser Console command line
http://developer.mozilla.org/docs/Tools/Browser_Console#Browser_Console_command_line

The following mozilla.cfg hack is not tested.

* <install directory>\defaults\pref\autoconfig.js

Code: Select all
pref("general.config.sandbox_enabled", false);
pref("general.config.filename", "mozilla.cfg");
pref("general.config.obscure_value", 0);

* <install directory>\mozilla.cfg

Code: Select all
// mozilla.cfg file needs to start with a comment line

Components.utils.import("resource://gre/modules/Services.jsm");

Services.obs.addObserver(function (aSubject, aTopic, aData) {
  var chromeWindow = aSubject;
  chromeWindow.setTimeout(function () {
    try {
      chromeWindow.addEventListener("keypress", function (event) {
        if (event.keyCode == event.DOM_VK_F10 && !event.shiftKey && !event.altKey && !event.ctrlKey) {
          event.preventDefault();
          event.stopPropagation();
        }
      }, true);
    } catch (e) {
      Components.utils.reportError(e); // [check] Show Content Messages
    }
  }, 10);
}, "browser-delayed-startup-finished", false);

Deploying Firefox in an enterprise environment
http://developer.mozilla.org/Firefox/Enterprise_deployment_before_60

Observer Notifications
http://developer.mozilla.org/docs/Mozilla/Tech/XPCOM/Observer_Notifications

Return to Firefox Support


Who is online

Users browsing this forum: No registered users and 11 guests