How to disable Command+D to "Bookmark This Page" in Mac?
I'm running Mojave 10.14.6 on a MacMini (late 2018) with 64 GB 2667 MHz DDR4 and Firefox v86.0 64-bit.
I need to disable Command+D that's currently used to "Bookmark This Page".
I need Command+D for another use.
I've searched about:config for "bookmark" and get a lot of hits, but I can't tell which one controls the setting for Command+D.
Or . . . am I barking up the wrong tree?
I want to disable Command+D.
Leaving the ability to mouse up and click Bookmarks > "Bookmark This Page" is ok.
I just need to disable the keyboard shortcut Command+D for "Bookmark This Page".
Anyone got a "howto" for this?
Thanks!
所有回复 (9)
Unfortunately, Firefox does not have a built-in way to disable most keyboard shortcuts. Add-ons also are not allowed to change them, with one exception. Web pages often can intercept pre-defined keyboard shortcuts and use them for their own purposes, so there are add-ons that inject script into pages to intercept those shortcuts. Depending on what you need to use Command+D for, that could be an option.
What did you have in mind for that shortcut?
"What did you have in mind for that shortcut?"
To be able to hover over a word, in any app or browser, and then use Command+D to open Dictionary and look up the word.
That would be easier on the hand than Control+Command+D, which I understand is the default shortcut for Dictionary.
You could check whether an extension like Saka Key can help with this. I don't know whether it has any way to associate Command+D with an external program.
You can possibly do this via code in an autoconfig.cfg file like in this sub reddit.
I tested on Linux and this disables Ctrl+D for me and should work on Mac as well.
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 directory.
- 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.
// pref("general.config.filename", "autoconfig.cfg"); pref("general.config.obscure_value", 0); pref("general.config.sandbox_enabled", false);
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)
On Mac you can use the TextEdit utility to create these files as a plain text file (i.e. the file shouldn't have rich text formatting code).
See also:
// autoconfig.cfg needs to start with a comment line try { let {classes:Cc, interfaces:Ci, utils:Cu} = Components; const {Services} = Cu.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 attr, elm, key; let KEYS = ["addBookmarkAsKb"]; // manBookmarkKb viewBookmarksSidebarKb viewBookmarksToolbarKb let ATTR = ['key','modifiers','command','oncommand']; for (key in KEYS){ elm = window.document.getElementById(KEYS[key]); if (elm) for (attr in ATTR) if (ATTR[attr] in elm.attributes) elm.removeAttribute(ATTR[attr]); } } } } }; if (!Services.appinfo.inSafeMode) { new ConfigJS(); } } catch(e) { Cu.reportError(e); }
由cor-el于
jscher2000 said
That would be easier on the hand than Control+Command+D, which I understand is the default shortcut for Dictionary. You could check whether an extension like Saka Key can help with this. I don't know whether it has any way to associate Command+D with an external program. https://addons.mozilla.org/firefox/addon/saka-key/
Hi,
Thanks for lead to Saka Key, but it wants to see and have access to too much of my data, so I declined to load it.
Anything else?
@ cor-el
Wow! You really know ur stuff!
Unfortunately for me, I'm not up to your speed with programming etc.
I need more hand-holding to implement your instruct.
I'm a good student and can follow directions!
"To use Autoconfig, place two files into the Firefox directory." Where's the Firefox directory?
"on macOS, they go into the Contents/Resources directory of the Firefox.app" Where's this?
"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." Wheres the "defaults\pref" directory where the "channel-prefs.js file is located"?
Sorry, I know I'm being a pain to someone with your expertise, but I'd really like to implement your fix!
Can you reply with more granular, step-by-painstaking-step instructions?
Thanks!
由JohnDohe于
That is about these locations in the Firefox installation directory:
- /Applications/Firefox.app/Contents/Resources/autoconfig.cfg
- /Applications/Firefox.app/Contents/Resources/defaults/pref/autoconfig.js
@ cor-el
Hi!
Ok, um, er, uh . . .
Where to find, /Applications/Firefox.app/Contents/Resources/autoconfig.cfg and, /Applications/Firefox.app/Contents/Resources/defaults/pref/autoconfig.js
Thanks!
/Applications/Firefox.app/Contents/Resources/ and /Applications/Firefox.app/Contents/Resources/defaults/pref/ are the locations where you need to create autoconfig.cfg and autoconfig.js (these files aren't there by default). You can use the Finder application to browse to these location and create both files with the above posted content. These files need to be plain text files and not files that have rich text formatting code like can be the default on Mac. On Mac you can use the TextEdit application to create these text files and save them in the correct location.