13

I have installed the Keyconfig add-on and configured it to toggle Offline Mode on Firefox, whenever I press Ctrl + Shift + O. It worked fine on previous versions of Firefox (before version 28.0).

However, now, when I have the Developer Tools pane open, pressing Ctrl + Shift + O causes the pane to switch to the Toolbox Options tab and consequently my 'toggle offline' option does not get triggered. (This happens only when the keyboard is 'focused' on the Developer Tools pane; if I'm actually working on a web page (i.e. some web page element is in focus), Ctrl + Shift + O always works regardless of whether the Developer Tools pane is open or not.)

I don't think a plugin or add-on would help in this regard, because the Ctrl + Shift + O shortcut assignment seems to be part of Firefox's Developer Tools pane itself. (After all, Keyconfig, via which I customized that shortcut, is also an add-on!)

As such, I'm looking for a possible way of altering the configurations of the Developer Tools toolbox (or Firefox itself, for that matter) in order to regain control of my keyboard shortcut Ctrl + Shift + O. (Well, I know it would be easier to change my shortcut to a different one, but I'm so accustomed to pressing Ctrl + Shift + O whenever required, that I cannot get rid of it now. :) ) I have been looking up the issue on the web for quite a long time, but still could not arrive at a satisfactory solution.

Any ideas/suggestions are highly appreciated.

5 Answers5

12

Extensions you can use with Firefox Quantum: Saka Key, Shortkeys

However any extension seems to be limited and does not work in various situations:

  • privileged pages such as https://addons.mozilla.org/
  • new tab page,
  • internal pages such as about:config,about:newtab,about:addons
  • outside of the webpage such as in the url bar/ search bar
  • before the page has finished loading

So from time-to-time your keyboard shortcuts will stop working, and you might run a totally different command that does something bad. Thanks Mozilla.

Credit: the list of limitations was gathered from the project pages of the two extensions.

Complex options requiring coding skills

var key = document.getElementById('viewBookmarksSidebarKb');
if (key) key.remove();
  • Write your own js, see code at bottom var _mappings = { (and paste it into [Browser Console] after you launch Firefox)

  • Binary hacking firefox (re-run the hack script after every Firefox upgrade)

AdamS
  • 316
2

macOS users can customize any app’s shortcuts as long as they appear in the application menus.

  1. On your Mac, choose Apple menu > System Preferences, click Keyboard, then click Shortcuts.

  2. Select App Shortcuts on the left, click the Add button

  3. In the Menu Title field, type the menu command for which you want to create a shortcut

More details on Apple’s site: https://support.apple.com/guide/mac-help/create-keyboard-shortcuts-for-apps-mchlp2271/mac

You can’t disable them however, you can just override them.

fregante
  • 645
1

Time to refresh the answer. The official support page now is good enough and also points to a new extension to customize kyeboard shortcuts called Saka that's experimental but kind of official and works great for me (Firefox 60 developer edition / Ubuntu Linux)

1

All credit goes to this answer on stackoverflow. This only disables specified built-in command.

Don't forget to replace Firefox64 for /usr/lib/firefox if under Linux (and backslashes too).

Add these files to specified directory.

Firefox64\defaults\pref\config-prefs.js

pref("general.config.filename", "config.js");    
pref("general.config.obscure_value", 0);  
pref("general.config.sandbox_enabled", false); 

Firefox64\config.js

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) {
       // there are lots of built-in commands specified in this variable, pick desired ones
       let keys = ["key_find", "key_findAgain", "key_findPrevious", "key_gotoHistory", "addBookmarkAsKb", "bookmarkAllTabsKb", "showAllHistoryKb", "manBookmarkKb", "viewBookmarksToolbarKb", "key_savePage", "key_search", "key_search2", "focusURLBar", "focusURLBar2", "key_openDownloads", "openFileKb", "key_reload_skip_cache", "key_viewSource", "key_viewInfo", "key_privatebrowsing", "key_quitApplication", "context-bookmarklink"];
       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(); }

You can get a list of ids for the keys from the source by putting the following URL in your browser

view-source:chrome://browser/content/browser.xhtml

Tested and working on firefox 108 under Linux (probably Windows too).

daru
  • 11
  • 1
  • 3
1

actually the Customizable Shortcuts Extension is able to change firefox shortcuts (and potentially show conflicts); you should give it a try.

However i'm still looking for a extension-less solution and the ability to totally disable a shortcuts...

Edit

As @louis noted, the customizable-shortcuts add-on has been discontinued (around 2016/2017). The sames features are now found in the shortkeys addon (GitHub).

bufh
  • 366