Thanks. I'll try it.morat wrote:@avada
Try something like:
Code: Select all
var css = []; css.push("#TabsToolbar { visibility: collapse !important; }"); // css.push("..."); // css.push("..."); var ios = Components.classes["@mozilla.org/network/io-service;1"]. getService(Components.interfaces.nsIIOService); var uri = ios.newURI("data:text/css," + encodeURIComponent(css.join("\n")), null, null); var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"]. getService(Components.interfaces.nsIStyleSheetService); if (sss.sheetRegistered(uri, sss.USER_SHEET)) { sss.unregisterSheet(uri, sss.USER_SHEET); } else { sss.loadAndRegisterSheet(uri, sss.USER_SHEET); }
keyconfig 20110522
-
- Posts: 1934
- Joined: February 10th, 2008, 6:30 am
- Location: Hungary
Re: keyconfig 20110522
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
The developer of Dorando keyconfig is having trouble updating the extension for Thunderbird 68.
Thunderbird 68 support
http://github.com/trlkly/dorando-keyconfig/issues/30
Anyone available to help port to Thunderbird 68?
http://thunderbird.topicbox.com/groups/ ... 654d8d20f5
Thunderbird 68 support
http://github.com/trlkly/dorando-keyconfig/issues/30
Anyone available to help port to Thunderbird 68?
http://thunderbird.topicbox.com/groups/ ... 654d8d20f5
-
- Posts: 200
- Joined: August 30th, 2013, 3:50 pm
Re: keyconfig 20110522
keyconfig for Fx 68:
https://github.com/xiaoxiaoflood/firefo ... config.xpi
Tb 68 uses Gecko 68, right? So it should be similar.
https://github.com/xiaoxiaoflood/firefo ... config.xpi
Tb 68 uses Gecko 68, right? So it should be similar.
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
@pintassilgo
Thanks.
In the keyconfig.xpi install.rdf file...
Firefox minVersion: 66.0a1
Firefox maxVersion: *
Thunderbird minVersion: 5.0b1
Thunderbird maxVersion: 61.0
I tried the extension after added a manifest.json file. I got a number of errors as expected.
* manifest.json
Lightning 68.1.0
Thunderbird Portable 68.1.0
Windows 7 SP1 32-bit
I posted the info about a Dorando keyconfig version that works with Firefox 68 in the Thunderbird 68 support thread.
About Thunderbird Addons
http://developer.thunderbird.net/add-ons/about-add-ons
Changes in Thunderbird 61-68
http://developer.thunderbird.net/add-ons/updates/tb68
Thunderbird WebExtension APIs
http://thunderbird-webextensions.readthedocs.io/
http://thunderbird-webextensions.readth ... egacy.html
Thanks.
In the keyconfig.xpi install.rdf file...
Firefox minVersion: 66.0a1
Firefox maxVersion: *
Thunderbird minVersion: 5.0b1
Thunderbird maxVersion: 61.0
I tried the extension after added a manifest.json file. I got a number of errors as expected.
* manifest.json
Code: Select all
{
"manifest_version": 2,
"name": "Dorando keyconfig",
"description": "Rebind your keys.",
"version": "2018.2.69.2019.07.07-xiao",
"author": "Dorando",
"homepage_url": "http://mozilla.dorando.at/",
"icons": {
"32": "icon.png",
"64": "icon64.png"
},
"legacy": {
"type" : "bootstrap",
"options": {
"page": "chrome://keyconfig/content/",
"open_in_tab": false
}
},
"applications": {
"gecko": {
"id": "keyconfig@mozilla.dorando.at",
"strict_min_version": "68.0"
}
}
}
Thunderbird Portable 68.1.0
Windows 7 SP1 32-bit
I posted the info about a Dorando keyconfig version that works with Firefox 68 in the Thunderbird 68 support thread.
About Thunderbird Addons
http://developer.thunderbird.net/add-ons/about-add-ons
Changes in Thunderbird 61-68
http://developer.thunderbird.net/add-ons/updates/tb68
Thunderbird WebExtension APIs
http://thunderbird-webextensions.readthedocs.io/
http://thunderbird-webextensions.readth ... egacy.html
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
You can use the userChromeJS extension to modify key bindings in Thunderbird 68. (for advance users only)
Example:
userChromeJS by jikamens
http://addons.thunderbird.net/thunderbird/addon/986610
Instructions:
1. install userChromeJS extension
2. close email client
3. create or edit the userChrome.js file in the chrome folder
4. open email client
You do not need to purge the caches with jikamens' version.
userChromeJS by alta88 (obsolete)
http://userchromejs.mozdev.org/
http://userchromejs.mozdev.org/faq.html
P.S.
You can view the source of a common chrome url using the error console.
i.e. Tools > Developer Tools > Error Console (Ctrl+Shift+J)
Reference
http://dxr.mozilla.org/comm-release/sea ... senger.xul
http://dxr.mozilla.org/comm-release/sea ... et.inc.xul
http://dxr.mozilla.org/comm-release/sea ... +ext%3Adtd
http://dxr.mozilla.org/comm-release/sou ... ersion.txt
Example:
Code: Select all
/* Thunderbird userChrome.js */
(function () {
/* List of common chrome urls:
*
* 3pane window > chrome://messenger/content/messenger.xul
* message window > chrome://messenger/content/messageWindow.xul
* compose window > chrome://messenger/content/messengercompose/messengercompose.xul
* address book window > chrome://messenger/content/addressbook/addressbook.xul
* prompt window > chrome://global/content/commonDialog.xul
*
*/
if (location == "chrome://messenger/content/messenger.xul") {
setTimeout(function () {
try {
/* unbind Help F1 */
var keyset = document.getElementById("mailKeys");
var key = document.getElementById("key_openHelp");
keyset.removeChild(key);
/* bind Example F1 */
window.__unique_identifier_example = function (event) {
alert("Example 1");
};
var keyset = document.getElementById("mailKeys");
var key = document.createXULElement("key");
key.setAttribute("id", "__unique_identifier_key_example");
// key.setAttribute("key", "A"); // A
// key.setAttribute("modifiers", "control,shift"); // Ctrl+Shift
// key.setAttribute("modifiers", "alt"); // Alt
key.setAttribute("keycode", "VK_F1"); // F1
// key.setAttribute("command", "cmd_toggleQuickFilterBar");
key.setAttribute("oncommand", "__unique_identifier_example(event);");
// key.setAttribute("oncommand", "alert('Example 2');");
keyset.appendChild(key);
} catch (e) {
Components.utils.reportError(e);
};
}, 1000);
}
if (location == "chrome://messenger/content/messageWindow.xul") {}
if (location == "chrome://messenger/content/messengercompose/messengercompose.xul") {}
if (location == "chrome://messenger/content/addressbook/addressbook.xul") {}
if (location == "chrome://global/content/commonDialog.xul") {}
})();
http://addons.thunderbird.net/thunderbird/addon/986610
Instructions:
1. install userChromeJS extension
2. close email client
3. create or edit the userChrome.js file in the chrome folder
4. open email client
You do not need to purge the caches with jikamens' version.
userChromeJS by alta88 (obsolete)
http://userchromejs.mozdev.org/
http://userchromejs.mozdev.org/faq.html
P.S.
You can view the source of a common chrome url using the error console.
i.e. Tools > Developer Tools > Error Console (Ctrl+Shift+J)
Code: Select all
(function () {
var urls = ["chrome://messenger/content/messenger.xul",
"chrome://messenger/content/messageWindow.xul",
"chrome://messenger/content/messengercompose/messengercompose.xul",
"chrome://messenger/content/addressbook/addressbook.xul",
"chrome://global/content/commonDialog.xul"];
document.getElementById("tabmail").openTab("contentTab", {
contentPage: "view-source:" + urls[0],
});
})();
http://dxr.mozilla.org/comm-release/sea ... senger.xul
http://dxr.mozilla.org/comm-release/sea ... et.inc.xul
http://dxr.mozilla.org/comm-release/sea ... +ext%3Adtd
http://dxr.mozilla.org/comm-release/sou ... ersion.txt
Last edited by morat on September 27th, 2019, 5:16 am, edited 1 time in total.
-
- Posts: 153
- Joined: January 23rd, 2009, 9:14 pm
- Location: Germany
Re: keyconfig 20110522
Thank you very much!morat wrote:You can use the userChromeJS extension to modify key bindings in Thunderbird 68. (for advance users only)
How must these be named in Firefox?
("key_openHelp")
("mailKeys")
How can I find the IDs of other keys in Thunderbird and Firefox?
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
@bege
userChromeJS is a legacy bootstrap extension. It doesn't work with Firefox.
You can use a trick to show the <keyset> and <key> elements using the error console.
i.e. Tools > Developer Tools > Error Console (Ctrl+Shift+J)
For example, pressing F8 in the 3pane window after running the code in the error console would output the following elements.
userChromeJS is a legacy bootstrap extension. It doesn't work with Firefox.
You can use a trick to show the <keyset> and <key> elements using the error console.
i.e. Tools > Developer Tools > Error Console (Ctrl+Shift+J)
Code: Select all
setTimeout(function () {
function getCommand(event) {
window.removeEventListener("command", getCommand, true);
event.preventDefault();
event.stopPropagation();
console.log(event.originalTarget.parentElement);
console.log(event.originalTarget);
console.log("event listener is removed");
Services.wm.getMostRecentWindow("devtools:webconsole").focus();
}
window.addEventListener("command", getCommand, true);
console.log("event listener is added");
}, 2000);
<keyset id="mailKeys">
The trick does not work for all user interface elements.<key id="key_toggleMessagePane" keycode="VK_F8" oncommand="goDoCommand('cmd_toggleMessagePane');">
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
@bege
I got an example script working with Firefox Portable 69 in Windows.
Deploying Firefox in an enterprise environment
http://developer.mozilla.org/docs/Mozil ... _before_60
* <install directory>\defaults\pref\autoconfig.js
* <install directory>\mozilla.cfg
Observer Notifications
http://developer.mozilla.org/docs/Mozil ... ifications
Reference
view-source:chrome://browser/content/browser.xhtml
view-source:chrome://browser/locale/browser.dtd
Edit:
Firefox 78 uses the browserSets.ftl file instead of the browser.dtd file.
view-source:resource:///localization/en-US/browser/browserSets.ftl
Reference
http://searchfox.org/mozilla-esr68/sear ... commandkey
http://searchfox.org/mozilla-esr78/sear ... n-shortcut
I got an example script working with Firefox Portable 69 in Windows.
Deploying Firefox in an enterprise environment
http://developer.mozilla.org/docs/Mozil ... _before_60
* <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);
Code: Select all
// mozilla.cfg file needs to start with a comment line
// mozilla.cfg file is sandboxed by default i.e. can't use the Components object
// disable the sandbox by setting the general.config.sandbox_enabled pref to false
// browser-delayed-startup-finished topic supports the browser window only
Components.utils.import("resource://gre/modules/Services.jsm");
Services.obs.addObserver(function (aSubject, aTopic, aData) {
// Services.obs.removeObserver(arguments.callee, "browser-delayed-startup-finished");
var chromeWindow = aSubject;
chromeWindow.setTimeout(function () {
// Services.console.logStringMessage("test mozilla.cfg");
// Services.prompt.alert(chromeWindow, "example", "test mozilla.cfg");
try {
/* unbind Find Again F3, note: key element has no id attribute */
var keyset = chromeWindow.document.getElementById("mainKeyset");
var key = chromeWindow.document.querySelector('key[keycode="VK_F3"][command="cmd_findAgain"]');
keyset.removeChild(key);
/* bind Example F3 */
chromeWindow.__unique_identifier_example = function (event) {
chromeWindow.alert("Example 1");
};
var keyset = chromeWindow.document.getElementById("mainKeyset");
var key = chromeWindow.document.createXULElement("key");
key.setAttribute("id", "__unique_identifier_key_example");
// key.setAttribute("key", "A"); // A
// key.setAttribute("modifiers", "control,shift"); // Ctrl+Shift
// key.setAttribute("modifiers", "alt"); // Alt
key.setAttribute("keycode", "VK_F3"); // F3
// key.setAttribute("command", "cmd_toggleOfflineStatus");
key.setAttribute("oncommand", "__unique_identifier_example(event);");
// key.setAttribute("oncommand", "alert('Example 2');");
keyset.appendChild(key);
} catch (e) {
Components.utils.reportError(e); // [check] Show Content Messages
};
}, 1000);
}, "browser-delayed-startup-finished", false);
http://developer.mozilla.org/docs/Mozil ... ifications
Reference
view-source:chrome://browser/content/browser.xhtml
view-source:chrome://browser/locale/browser.dtd
Edit:
Firefox 78 uses the browserSets.ftl file instead of the browser.dtd file.
view-source:resource:///localization/en-US/browser/browserSets.ftl
Reference
http://searchfox.org/mozilla-esr68/sear ... commandkey
http://searchfox.org/mozilla-esr78/sear ... n-shortcut
Last edited by morat on December 17th, 2020, 6:29 pm, edited 3 times in total.
-
- Posts: 153
- Joined: January 23rd, 2009, 9:14 pm
- Location: Germany
Re: keyconfig 20110522
@morat
Thank you very much.
If I want to unbind a key, e.g. F1, do I need to know the command or is the keycode enough? If not, how do I find out the command? I tried the code you posted for Thunderbird, but that works only for very few keys in Firefox.
Thank you very much.
If I want to unbind a key, e.g. F1, do I need to know the command or is the keycode enough? If not, how do I find out the command? I tried the code you posted for Thunderbird, but that works only for very few keys in Firefox.
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
@bege
The example script like the keyconfig extension only works with shortcuts created with a key element, not with shortcuts created with an event listener.
key element
http://developer.mozilla.org/docs/Archi ... la/XUL/key
You need to find the key element for the Find Again F3 shortcut to unbind the key.
Try searching for a line with the "F3" string in the browser.dtd file.
Try searching for a line with the "findAgainCmd.commandkey2" string in the browser.xhtml file.
The key element doesn't have an id attribute, so I'm using the document.querySelector() method instead of the document.getElementById() method.
P.S.
I didn't think Firefox had a F1 shortcut.
Firefox shortcuts
http://support.mozilla.org/kb/keyboard- ... ks-quickly
The example script like the keyconfig extension only works with shortcuts created with a key element, not with shortcuts created with an event listener.
key element
http://developer.mozilla.org/docs/Archi ... la/XUL/key
You need to find the key element for the Find Again F3 shortcut to unbind the key.
Try searching for a line with the "F3" string in the browser.dtd file.
Code: Select all
<!ENTITY findAgainCmd.commandkey2 "VK_F3">
Code: Select all
<key keycode="&findAgainCmd.commandkey2;" command="cmd_findAgain"/>
P.S.
I didn't think Firefox had a F1 shortcut.
Firefox shortcuts
http://support.mozilla.org/kb/keyboard- ... ks-quickly
-
- Posts: 153
- Joined: January 23rd, 2009, 9:14 pm
- Location: Germany
Re: keyconfig 20110522
Thank you again.
This script works with Alt+W but not with F1.
What may be the reason that binding a command to F1 does not work in Firefox?morat wrote: I didn't think Firefox had a F1 shortcut.
This script works with Alt+W but not with F1.
Code: Select all
// ==UserScript==
// key.CloseAllTabs_aborix.uc.js
// https://www.camp-firefox.de/forum/viewtopic.php?p=1099118#p1099118
// ==/UserScript==
(function() {
var browser_chrome = AppConstants.BROWSER_CHROME_URL;
if (location != browser_chrome)
return;
let key = document.createXULElement('key');
key.id = 'key_closeAllTabs';
key.setAttribute('key', 'W');
// key.setAttribute('keycode', 'VK_F1')
key.setAttribute('modifiers', 'alt');
key.setAttribute('oncommand',
'gBrowser.removeAllTabsBut(gBrowser.selectedTab); gBrowser.removeTab(gBrowser.selectedTab);');
document.getElementById('mainKeyset').appendChild(key);
})();
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
The code snippets succeed for me using the browser console.
If the code snippets fail for you, then try disabling all extensions, restart and test again using the browser console.
Browser Console command line
http://developer.mozilla.org/docs/Tools ... mmand_line
Code: Select all
(function () {
var browser_chrome = AppConstants.BROWSER_CHROME_URL;
if (location != browser_chrome) return;
var key = document.createXULElement('key');
key.id = 'key_closeAllTabs';
key.setAttribute('keycode', 'VK_F1');
key.setAttribute('oncommand', 'gBrowser.removeAllTabsBut(gBrowser.selectedTab); gBrowser.removeTab(gBrowser.selectedTab);');
document.getElementById('mainKeyset').appendChild(key);
})();
Code: Select all
(function () {
var keyset = document.getElementById('mainKeyset');
var key = document.createXULElement('key');
key.setAttribute('id', '__unique_identifier_key_test');
key.setAttribute('keycode', 'VK_F1');
key.setAttribute('oncommand', 'alert("test");');
keyset.appendChild(key);
})();
Browser Console command line
http://developer.mozilla.org/docs/Tools ... mmand_line
-
- Posts: 153
- Joined: January 23rd, 2009, 9:14 pm
- Location: Germany
Re: keyconfig 20110522
After entering the code in the console this error is in the console:
NS_NOINTERFACE: Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] stack-trace-collector.js:90
If I then press F1 the console shows this error:
uncaught exception: Object
Do you have any idea before I do more testing?
NS_NOINTERFACE: Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] stack-trace-collector.js:90
If I then press F1 the console shows this error:
uncaught exception: Object
Do you have any idea before I do more testing?
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: keyconfig 20110522
Try checking for key elements with the keycode="VK_F1" attribute using the browser console.
Try testing the second code snippet using the browser console in a fresh profile or a fresh Firefox Portable install.
Firefox Portable
http://portableapps.com/apps/internet/firefox_portable
I get the stack-trace-collector.js error as well. Ignore it.
stack-trace-collector.js error message
http://bugzilla.mozilla.org/show_bug.cgi?id=1565343
Code: Select all
console.log(document.querySelectorAll('key[keycode="VK_F1"]').length); // 0
Code: Select all
console.log(document.querySelectorAll('key[keycode="VK_F3"]').length); // 2
console.log(document.querySelectorAll('key[keycode="VK_F3"]')[0]); // Find Again F3
console.log(document.querySelectorAll('key[keycode="VK_F3"]')[1]); // Find Previous Shift+F3
Firefox Portable
http://portableapps.com/apps/internet/firefox_portable
I get the stack-trace-collector.js error as well. Ignore it.
stack-trace-collector.js error message
http://bugzilla.mozilla.org/show_bug.cgi?id=1565343
-
- New Member
- Posts: 1
- Joined: October 1st, 2019, 7:13 pm
Re: keyconfig 20110522
Thanks to the guidance from previous posters, I installed userChromeJs and successfully brought back some of my favorite Gmail-style keyboard shortcuts with the following chrome/userChrome.js file inside my TB profile directory:
Code: Select all
/* Thunderbird userChrome.js */
(function () {
function unbindKey(id, keyChar, keycode, modifiers) {
var key;
if (typeof id == "string") {
key = document.getElementById(id);
} else {
if (typeof modifiers == "string") {
modifierClause = '[modifiers="' + modifiers + '"]';
} else {
modifierClause = ':not([modifiers])'
}
if (typeof keyChar == "string") {
key = document.querySelector('key[key="' + keyChar + '"]' + modifierClause);
} else if (typeof keycode == "string") {
key = document.querySelector('key[keycode="' + keycode + '"]' + modifierClause);
}
}
if ((key !== null) && (typeof key == 'object') && (typeof key.removeAttribute == 'function')) {
key.removeAttribute("key");
key.removeAttribute("keycode");
}
}
function changeKeyStrokeForKeyId(id, keyChar, keycode, modifiers) {
unbindKey(null, keyChar, keycode, modifiers);
var key = document.getElementById(id);
if (typeof keyChar == "string") {
key.setAttribute("key", keyChar);
key.removeAttribute("keycode");
} else if (typeof keycode == "string") {
key.setAttribute("keycode", keycode);
key.removeAttribute("key");
}
if (typeof modifiers == "string") {
key.setAttribute("modifiers", modifiers);
} else {
key.removeAttribute("modifiers");
}
}
function changeMessageViewShortcuts() {
changeKeyStrokeForKeyId("key_archive", "e");
changeKeyStrokeForKeyId("key_reply", "r");
changeKeyStrokeForKeyId("key_replyall", "a");
changeKeyStrokeForKeyId("key_forward", "f");
changeKeyStrokeForKeyId("key_newMessage", "c");
changeKeyStrokeForKeyId("key_searchMail", "/");
changeKeyStrokeForKeyId("key_delete", "3", null, "shift");
unbindKey(null, "3", null, "shift any");
}
/* List of common chrome urls:
*
* 3pane window > chrome://messenger/content/messenger.xul
* message window > chrome://messenger/content/messageWindow.xul
* compose window > chrome://messenger/content/messengercompose/messengercompose.xul
* address book window > chrome://messenger/content/addressbook/addressbook.xul
* prompt window > chrome://global/content/commonDialog.xul
*
*/
if (location == "chrome://messenger/content/messenger.xul") {
setTimeout(function () {
try {
changeMessageViewShortcuts();
} catch (e) {
Components.utils.reportError(e);
};
}, 1000);
}
if (location == "chrome://messenger/content/messageWindow.xul") {
setTimeout(function () {
try {
changeMessageViewShortcuts();
} catch (e) {
Components.utils.reportError(e);
};
}, 1000);
}
if (location == "chrome://messenger/content/messengercompose/messengercompose.xul") {}
if (location == "chrome://messenger/content/addressbook/addressbook.xul") {}
if (location == "chrome://global/content/commonDialog.xul") {}
})();