Skip to content

Commit

Permalink
Explode 2016.2 version of add-on from AMO
Browse files Browse the repository at this point in the history
* Compatibility changes necessary since Dorando's last release in 2011.
* Add icons.
* Move files from the "src" subdirectory into the top-level directory.
* Get rid of README and merge its contents into README.md, stating explicitly there that the current maintainers of the add-on are not asserting any new copyright over and above Dorando's.
* The current version of the add-on no longer packages any files in a ZIP file within the XPI (good!).
* Remove the pre-compiled, committed version of the XPI, since we're commiting all the files in it as top-level files now.
* Update README.md:

   * This add-on is not compatible with Firefox 57 and newer.
   * Remind people to uninstall Dorando's version of keyconfig before installing this one.
   * Add instructions for running the add-on from source code.
  • Loading branch information
jikamens committed Oct 7, 2017
1 parent e6e692d commit 8615974
Show file tree
Hide file tree
Showing 47 changed files with 195 additions and 169 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
keyconfig.xpi
keyconfig.zip


11 changes: 3 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
keyconfig.xpi: keyconfig.zip
keyconfig.xpi:
rm -f $@.tmp
zip -r $@.tmp install.rdf chrome.manifest defaults components $<
zip -r $@.tmp install.rdf chrome.manifest README.md icon.png icon64.png defaults components content locale skin
mv -f $@.tmp $@

keyconfig.zip:
rm -f $@.tmp
cd src; zip -r ../$@.tmp *
mv -f $@.tmp $@

clean: ; -rm -rf keyconfig.xpi keyconfig.zip
clean: ; -rm -rf keyconfig.xpi

43 changes: 40 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
# dorando-keyconfig

A modified version of Dorando's tool to rebind keys in Mozilla apps. It is designed to be a drop-in replacement, and will keep your old settings. (See official version webpage for upgrade instructions.)
A modified version of [Dorando](http://mozilla.dorando.at/readme.html)'s tool to rebind keys in Mozilla apps. It is designed to be a drop-in replacement, and will keep your old settings. (See official version webpage for upgrade instructions.)

[Official version available here](https://addons.mozilla.org/en-US/firefox/addon/dorando-keyconfig/).
The only changes here are non-functional changes for compatibility with newer app versions, since Dorando is no longer maintaining the add-on.

To install the development version, open the compiled folder and follow the instructions. Note that, if the version numbers are the same as the official version, then it is the same addon.
Note that this add-on is _not_ compatible with Firefox 57 and newer, since it uses old add-on APIs that are no longer supported as of Firefox 57. However, it remains compatible with current versions of Thunderbird and SeaMonkey.

You can install this add-on [from addons.mozilla.org](https://addons.mozilla.org/firefox/addon/dorando-keyconfig/). **If you are replacing Dorando's version of the add-on from 2011 or earlier with this version, make sure to uninstall Dorando's version before installing this one.**

## Working with the source code

To deploy the source code directly into Firefox, Thunderbird, or Mozilla, so that you can make changes here and then test them in the application without having to create and install a new XPI file:

1. Install the add-on normally from addons.mozilla.org.

2. Shut down the app.

3. Locate the "extensions" subdirectory of your app profile directory.

4. Locate the file "[email protected]" in that directory and delete it.

5. Create a new text file called "[email protected]" (note: no ".xpi" extension). In that file, put the full path to the directory this source code is in.

6. Locate the "prefs.js" file in your app profile directory.

7. Put this in it:

user_pref("extensions.startupScanScopes", 5);

8. Restart the app from the command line with the argument `-purgecaches`.

9. Confirm that the add-on shows up in the add-ons listing.

Whenever you start the app with `-purgecaches` from this point forward, it will reload the current version of the add-on code from your source directory. It may also pick up your changes even when you don't specify `-purgecaches`, but the only way to be _certain_ that it will notice your changes is to specify that argument.

## Copyright

Dorando's original copyright is as follows:

>Copyright (c) 2004-2011 Dorando.
>Permission is granted to copy, distribute, and/or modify any part of this package.
The maintainers of this updated version of the add-on do not claim any additional copyright. In other words, the copyright above still applies.
30 changes: 15 additions & 15 deletions chrome.manifest
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
content keyconfig jar:keyconfig.zip!/content/
locale keyconfig en-US jar:keyconfig.zip!/locale/en-US/
locale keyconfig cs-CZ jar:keyconfig.zip!/locale/cs-CZ/
locale keyconfig da-DK jar:keyconfig.zip!/locale/da-DK/
locale keyconfig de-DE jar:keyconfig.zip!/locale/de-DE/
locale keyconfig es-AR jar:keyconfig.zip!/locale/es-AR/
locale keyconfig fr-FR jar:keyconfig.zip!/locale/fr-FR/
locale keyconfig it-IT jar:keyconfig.zip!/locale/it-IT/
locale keyconfig ja-JP jar:keyconfig.zip!/locale/ja-JP/
locale keyconfig ko-KR jar:keyconfig.zip!/locale/ko-KR/
locale keyconfig ru-RU jar:keyconfig.zip!/locale/ru-RU/
locale keyconfig sk-SK jar:keyconfig.zip!/locale/sk-SK/
locale keyconfig zh-CN jar:keyconfig.zip!/locale/zh-CN/
locale keyconfig zh-TW jar:keyconfig.zip!/locale/zh-TW/
skin keyconfig classic/1.0 jar:keyconfig.zip!/skin/
content keyconfig content/
locale keyconfig en-US locale/en-US/
locale keyconfig cs-CZ locale/cs-CZ/
locale keyconfig da-DK locale/da-DK/
locale keyconfig de-DE locale/de-DE/
locale keyconfig es-AR locale/es-AR/
locale keyconfig fr-FR locale/fr-FR/
locale keyconfig it-IT locale/it-IT/
locale keyconfig ja-JP locale/ja-JP/
locale keyconfig ko-KR locale/ko-KR/
locale keyconfig ru-RU locale/ru-RU/
locale keyconfig sk-SK locale/sk-SK/
locale keyconfig zh-CN locale/zh-CN/
locale keyconfig zh-TW locale/zh-TW/
skin keyconfig classic/1.0 skin/

overlay chrome://browser/content/browser.xul chrome://keyconfig/content/overlay.xul
overlay chrome://messenger/content/mailWindowOverlay.xul chrome://keyconfig/content/overlay.xul
Expand Down
9 changes: 0 additions & 9 deletions compiled/README.md

This file was deleted.

Binary file removed compiled/dorando_keyconfig-2016.2-an+sm+tb+fx+fn.xpi
Binary file not shown.
40 changes: 31 additions & 9 deletions components/keyconfig-service.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,41 @@ keyconfigService.prototype = {

this.keyconfig.removedKeys = this.document.documentElement.appendChild(this.document.createElement("keyconfig"));

this.keyconfig.profile = "keyconfig." + this.keyconfig.service.ps.getCharPref("keyconfig.profile") + ".";

if (this.keyconfig.service.ps.prefHasUserValue("keyconfig.global.20110522")) {
var oldBranch = "keyconfig."; var newBranch = "extensions.dorandoKeyConfig.";
var oldKeys = this.keyconfig.service.ps.getChildList(oldBranch)
for (var i = 0; i < oldKeys.length; i++) {
var newKey = newBranch + oldKeys[i].split(oldBranch)[1];
switch (this.keyconfig.service.ps.getPrefType(oldKeys[i])) {
case 32: //PREF_STRING
var value = this.keyconfig.service.ps.getCharPref(oldKeys[i]);
this.keyconfig.service.ps.setCharPref(newKey, value);
break;

case 64: //PREF_INT
var value = this.keyconfig.service.ps.getIntPref(oldKeys[i]);
this.keyconfig.service.ps.setIntPref(newKey, value);
break;

case 128: //PREF_BOOLEAN
var value = this.keyconfig.service.ps.getBoolPref(oldKeys[i]);
this.keyconfig.service.ps.setBoolPref(newKey, value);
break;
}
}
this.keyconfig.service.ps.deleteBranch(oldBranch);
}

this.keyconfig.service.ps.deleteBranch("extensions.dorandoKeyConfig.global")

this.keyconfig.profile = "extensions.dorandoKeyConfig." + this.keyconfig.service.ps.getCharPref("extensions.dorandoKeyConfig.profile") + ".";

var i, l;

var keyset = this.document.getElementsByTagName("keyset")[0] ||
this.document.documentElement.appendChild(this.document.createElement("keyset"));

var code = this.keyconfig.service.ps.getCharPref("keyconfig.global.20110522");
if(code) {
this.keyconfig.service.document = this.document;
with(this.keyconfig.service) eval(code);
delete this.keyconfig.service.document;
}

var nodes = this.document.getElementsByTagName("key");
for(i = 0, l = nodes.length; i < l; i++) if(!nodes[i].id)
nodes[i].id = "xxx_key"+ i +"_"+nodes[i].getAttribute("command")+nodes[i].getAttribute("oncommand");
Expand All @@ -94,7 +115,8 @@ keyconfigService.prototype = {
if(key[3] && (!key[4] || key[4] == this.document.location)) {
node = keyset.appendChild(this.document.createElement("key"));
node.id = keys[i].substr(this.keyconfig.profile.length);
node.setAttribute("oncommand",key[3]);
// node.addEventListener("command",key[3]);
node.setAttribute("oncommand",key[3])
} else {
node = this.document.getElementById(keys[i].substr(this.keyconfig.profile.length));
if(!node) continue;
Expand Down
File renamed without changes.
43 changes: 24 additions & 19 deletions src/content/keyconfig.js → content/keyconfig.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ function onLoad() {
var XULAppInfo = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
var isThunderbird = XULAppInfo.name == "Thunderbird";

gReverseNames = isThunderbird ^ gPrefService.getBoolPref("keyconfig.nicenames.reverse_order");
gReverseNames = isThunderbird ^ gPrefService.getBoolPref("extensions.dorandoKeyConfig.nicenames.reverse_order");

if(gPrefService.getBoolPref("keyconfig.devmode")){ this.getFormattedKey = function(a,b,c) {return (a+"+"+b+c).replace(/null/g,"");} }
if(gPrefService.getBoolPref("extensions.dorandoKeyConfig.devmode")){ this.getFormattedKey = function(a,b,c) {return (a+"+"+b+c).replace(/null/g,"");} }

var target = window.arguments ? window.arguments[0] : WindowMediator.getEnumerator(null).getNext();

Expand All @@ -74,7 +74,7 @@ function init(target) {
gKeys = [];
gRemovedKeys = target.keyconfig.removedKeys;

var hideDisabled = gPrefService.getBoolPref("keyconfig.hideDisabled");
var hideDisabled = gPrefService.getBoolPref("extensions.dorandoKeyConfig.hideDisabled");

var keys = gDocument.getElementsByTagName("key");
for(var i = 0, l = keys.length; i < l; i++) {
Expand Down Expand Up @@ -189,9 +189,9 @@ function Recognize(event) {
gEdit.value = getFormattedKey(modifiers,key,keycode);
gEdit.keys = [modifiers,key,keycode];

if(!(gPrefService.getBoolPref("keyconfig.allowAltCodes") && modifiers == "alt" && key && !isNaN(key))) {
if(gPrefService.getBoolPref("keyconfig.warnOnDuplicate") && gEdit.value != gEdit.key.shortcut && gUsedKeys[gEdit.value])
window.setTimeout(alert,0,gStrings.used.replace("$1",gUsedKeys[gEdit.value].join("\n")));
if(!(gPrefService.getBoolPref("extensions.dorandoKeyConfig.allowAltCodes") && modifiers == "alt" && key && !isNaN(key))) {
if(gPrefService.getBoolPref("extensions.dorandoKeyConfig.warnOnDuplicate") && gEdit.value != gEdit.key.shortcut && gUsedKeys[gEdit.value])
window.setTimeout(function(){ window.alert(gStrings.used.replace("$1",gUsedKeys[gEdit.value].join("\n"))) },0);

gEdit.nextSibling.focus();
}
Expand Down Expand Up @@ -267,7 +267,7 @@ function Reset() {
try{ gPrefService.clearUserPref(gProfile+key.id); } catch(err) {}

key.pref = [];
key.shortcut = gEdit.value = gStrings.onreset;
key.shortcut = gEdit.value = gStrings.uponreset;
gEdit.keys = ["!",null,null];

gExtra2.label = gStrings.add;
Expand Down Expand Up @@ -295,7 +295,7 @@ function Key(aKey) {
aKey.hasAttribute("keycode") ? aKey.getAttribute("keycode") : null
);
this.id = aKey.id;
if(aKey.getAttribute("keyconfig") == "resetted") this.shortcut = gStrings.onreset;
if(aKey.getAttribute("keyconfig") == "resetted") this.shortcut = gStrings.uponreset;

try {
this.pref = gPrefService.getComplexValue(gProfile+aKey.id, Components.interfaces.nsISupportsString).data.split("][");
Expand Down Expand Up @@ -330,7 +330,7 @@ function detectUsedKeys() {
gUsedKeys[gKeys[i].shortcut]=[gKeys[i].name];
}

gUsedKeys[gStrings.disabled] = gUsedKeys[gStrings.onreset] = {length: 0}
gUsedKeys[gStrings.disabled] = gUsedKeys[gStrings.uponreset] = {length: 0}
}

function openEditor(type) {
Expand Down Expand Up @@ -394,7 +394,9 @@ function closeEditor(fields) {
node = target.keyconfig.removedKeys.appendChild(target.document.createElement("key"));

node.id = key.id;
node.setAttribute("oncommand",key.code);
//node.addEventListener("command",key.code);
node.setAttribute("oncommand",key.code);

}

keyTree.treeBoxObject.invalidateRow(keyTree.currentIndex);
Expand All @@ -414,15 +416,18 @@ var keyView = {
canDrop: function() { return false; },
getParentIndex: function() { return -1; },

getCellProperties: function(row,col,props) {
var key = gKeys[row];
if(key.hardcoded) props.AppendElement(gAtomService.getAtom("hardcoded"));
if(key.disabled) props.AppendElement(gAtomService.getAtom("disabled"));
if(key.pref[3]) props.AppendElement(gAtomService.getAtom("custom"));
if(key.pref.length) props.AppendElement(gAtomService.getAtom("user"));
if((col.id || col) == "shortcut" && gUsedKeys[key.shortcut].length > 1)
props.AppendElement(gAtomService.getAtom("duplicate"));
},
getCellProperties: function(row,col) {
var key = gKeys[row];
// try { console.log ( key + " " + key.shortcut ) } catch(e) {};
//try { if (key.shortcut ) return "reset"; } catch(e) {console.log(e)}
if(key.hardcoded) return "hardcoded";
if(key.disabled) return "disabled";
if(key.pref[3]) return "custom";
if(key.pref.length) return "user";
if((col.id || col) == "shortcut" && gUsedKeys[key.shortcut].length > 1)
return "duplicate";
return "";
},
getColumnProperties: function(){},
selectionChanged: function() {
var key = gKeys[this.selection.currentIndex];
Expand Down
2 changes: 1 addition & 1 deletion src/content/keyconfig.xul → content/keyconfig.xul
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var gStrings = {
used: "&keyconfig.used;",
add: "&keyconfig.add;",
edit: "&keyconfig.edit;",
onreset: "&keyconfig.onreset;",
uponreset: "&keyconfig.onreset;",
unrecognized: "&keyconfig.unrecognized;",
disabled: "&keyconfig.disabled;"
}
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 6 additions & 8 deletions defaults/preferences/keyconfig.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
pref("keyconfig.devmode", false);
pref("keyconfig.nicenames.reverse_order", false);
pref("keyconfig.profile", "main");
pref("keyconfig.warnOnDuplicate", true);
pref("keyconfig.allowAltCodes", true);
pref("keyconfig.global.20110522", "Module('Detect');");
pref("keyconfig.UIHook", "");
pref("keyconfig.hideDisabled", false);
pref("extensions.dorandoKeyConfig.devmode", false);
pref("extensions.dorandoKeyConfig.nicenames.reverse_order", false);
pref("extensions.dorandoKeyConfig.profile", "main");
pref("extensions.dorandoKeyConfig.warnOnDuplicate", true);
pref("extensions.dorandoKeyConfig.allowAltCodes", true);
pref("extensions.dorandoKeyConfig.hideDisabled", false);
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 46 additions & 22 deletions install.rdf
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,59 @@
xmlns="http://www.mozilla.org/2004/em-rdf#">

<rdf:Description rdf:about="urn:mozilla:install-manifest">
<id>keyconfig@dorando</id>
<name>keyconfig</name>
<version>20110522</version>
<id>keyconfig@mozilla.dorando.at</id>
<name>Dorando keyconfig</name>
<version>2016.2</version>
<creator>Dorando</creator>
<contributor>Hadar Hagai</contributor>
<contributor>MatrixIsAllOver of eXtenZilla.it (it-IT)</contributor>
<contributor>Mori (fr-FR)</contributor>
<contributor>SHIMODA Hiroshi (ja-JP)</contributor>
<contributor>SlovakSoft (sk-SK)</contributor>
<contributor>Tomáš Kopečný (cs-CZ)</contributor>
<contributor>ReinekeFux - erweiterungen.de (de-DE)</contributor>
<contributor>stoneflash (ru-RU)</contributor>
<contributor>ZuGro (es-AR)</contributor>
<contributor>rexx26 (zh-TW)</contributor>
<contributor>kyo (ko-KR)</contributor>
<contributor>Cye3s (zh-CN)</contributor>
<contributor>Jørgen Rasmussen (da-DK)</contributor>
<contributor>Jack Black (fr-FR)</contributor>
<contributor>trlkly</contributor>
<translator>MatrixIsAllOver of eXtenZilla.it (it-IT)</translator>
<translator>Mori (fr-FR)</translator>
<translator>SHIMODA Hiroshi (ja-JP)</translator>
<translator>SlovakSoft (sk-SK)</translator>
<translator>Tomáš Kopečný (cs-CZ)</translator>
<translator>ReinekeFux - erweiterungen.de (de-DE)</translator>
<translator>stoneflash (ru-RU)</translator>
<translator>ZuGro (es-AR)</translator>
<translator>rexx26 (zh-TW)</translator>
<translator>kyo (ko-KR)</translator>
<translator>Cye3s (zh-CN)</translator>
<translator>Jørgen Rasmussen (da-DK)</translator>
<translator>Jack Black (fr-FR)</translator>
<homepageURL>http://mozilla.dorando.at/</homepageURL>
<description>Rebind your keys.</description>
<optionsURL>chrome://keyconfig/content/</optionsURL>
<updateURL>http://mozilla.dorando.at/keyconfig/update.rdf</updateURL>
<updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDK6mnSoPBfEHUfK+8UiWIXmfS5mP+ZBV+w0s0i40FCG5G609oo7aOEgkFSNiGCmzCibLF1
rS0mHY6GGKAEJmQwJ8WA/QNaHsS4mTAeINPMeSlm+Pw3hN61/9IaU+RjuukKPedICrY09tm8zQEJu1VtTx4KMg1GWSLaAQxIQzxJQIDAQAB</updateKey>
<type>2</type> <!-- type=extension -->
<multiprocessCompatible>true</multiprocessCompatible>

<targetApplication><rdf:Description>
<id>[email protected]</id>
<minVersion>1.9a8</minVersion>
<maxVersion>2.0.1</maxVersion>
<id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id> <!--Firefox-->
<minVersion>4.0</minVersion>
<maxVersion>43.*</maxVersion>
</rdf:Description></targetApplication>

<targetApplication><rdf:Description>
<id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</id> <!--Thunderbird-->
<minVersion>5.0b1</minVersion>
<maxVersion>37.*</maxVersion>
</rdf:Description></targetApplication>

<targetApplication><rdf:Description>
<id>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</id> <!--Firefox (Android)-->
<minVersion>10.0a1</minVersion>
<maxVersion>37.*</maxVersion>
</rdf:Description></targetApplication>

<targetApplication><rdf:Description>
<id>{a23983c0-fd0e-11dc-95ff-0800200c9a66}</id> <!--Mobile-->
<minVersion>4.0</minVersion>
<maxVersion>37.*</maxVersion>
</rdf:Description></targetApplication>

<targetApplication><rdf:Description>
<id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</id> <!--SeaMonkey-->
<minVersion>2.1</minVersion>
<maxVersion>2.33.*</maxVersion>
</rdf:Description></targetApplication>

</rdf:Description>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8615974

Please sign in to comment.