keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
Post Reply
bege
Posts: 153
Joined: January 23rd, 2009, 9:14 pm
Location: Germany

Re: keyconfig 20110522

Post by bege »

Qwerky wrote:The upper box is for key bindings for the main window; the lower box is for key bindings for the compose window.
Thank you!
Cleverson
Posts: 16
Joined: March 11th, 2009, 3:09 pm

Re: keyconfig 20110522

Post by Cleverson »

Hi,

Has this extension been discontinued? the keyconfig.xpi file I can download here says it seems corrupted when I try to install it on Thunderbird 102.3.
If discontinued, I'd please like suggestions on some alternative extension, not only to change existing shortcuts, but to create new functionality and assign it to a key.

thanks,
Cleverson
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@Cleverson

The keyconfig addon is no longer supported.

You can create keyboard shortcuts that execute custom commands with the tbkeys addon.

tbkeys
http://github.com/wshanks/tbkeys#tbkeys

tbkeys-lite (cannot run arbitrary javascript)
http://addons.thunderbird.net/thunderbird/addon/987885

More info: http://forums.mozillazine.org/viewtopic ... start=3480
Cleverson
Posts: 16
Joined: March 11th, 2009, 3:09 pm

Re: keyconfig 20110522

Post by Cleverson »

Thanks very much.
Cleverson
Posts: 16
Joined: March 11th, 2009, 3:09 pm

Re: keyconfig 20110522

Post by Cleverson »

Hi Morat,

Are you able to give me some support on the TBKeys extension? I wrote to Will the dev via his e-mail provided at the lite's page, but got no answer.

I added an old keyconfig code to tbkeys' text area corresponding to the main window, then replaced newline characters with spaces to fit json, then guessed I should add backslashes before quote characters, but my key didn't work.

Here is the complete contents of tbkey's text area, including the unsets after I pressed Unset Singles:

Code: Select all

{
    "ctrl+h": "varnextMode=pref.getIntPref(\"mailnews.nav_crosses_folders\"); pref.setIntPref(\"mailnews.nav_crosses_folders\",0); CrossFolderNavigation(nsMsgNavigationType.nextUnreadMessage); pref.setIntPref(\"mailnews.nav_crosses_folders\",nextMode);",
    "0": "unset",
    "1": "unset",
    "2": "unset",
    "3": "unset",
    "4": "unset",
    "5": "unset",
    "6": "unset",
    "7": "unset",
    "8": "unset",
    "9": "unset",
    "b": "unset",
    "m": "unset",
    "p": "unset",
    "s": "unset",
    "t": "unset",
    "w": "unset",
    "]": "unset",
    "[": "unset"
}
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@Cleverson

Normally, a user creates an issue on GitHub for support.

http://github.com/wshanks/tbkeys/issues ... dated-desc

Here is the corrected ctrl+h command. (not tested)

Code: Select all

(function () {
  var nextMode = window.Services.prefs.getIntPref('mailnews.nav_crosses_folders');
  window.Services.prefs.setIntPref('mailnews.nav_crosses_folders', 0);
  window.CrossFolderNavigation(window.Components.interfaces.nsMsgNavigationType.nextUnreadMessage);
  window.Services.prefs.setIntPref('mailnews.nav_crosses_folders', nextMode);
})();
Remember to remove the newline characters before pasting the self executing anonymous function into the double quotes.

Are you using tbkey or tbkeys-lite? You cannot run arbitrary javascript with tbkeys-lite.

There is a tbkeys.xpi link on the releases page.

http://github.com/wshanks/tbkeys#install
Cleverson
Posts: 16
Joined: March 11th, 2009, 3:09 pm

Re: keyconfig 20110522

Post by Cleverson »

Thanks Morat, worked very well.
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

Hello!

I had this for a long while in keyconfig (via morat), to send text to the urlbar:

Code: Select all

  var script = "data:text/plain," + encodeURIComponent(`
    var data = {};
    data.selection = null;
    var selection = content.getSelection();
    if (selection.isCollapsed) {
      var element = content.document.activeElement;
      if (element instanceof HTMLTextAreaElement ||
          element instanceof HTMLInputElement &&
         (element.type ==     "text" ||
          element.type == "password" ||
          element.type ==    "email" ||
          element.type ==   "search" ||
          element.type ==      "tel" ||
          element.type ==      "url")) {
        var start = element.selectionStart;
        var end = element.selectionEnd;
        data.selection = element.value.substring(start, end);
      }
    } else {
      data.selection = selection.toString();
    }
    sendAsyncMessage("foobar", data);
  `);
  gBrowser.selectedBrowser.messageManager.addMessageListener("foobar", function removeMe(message) {
    gBrowser.selectedBrowser.messageManager.removeMessageListener("foobar", removeMe);
    if (message.data.selection) {
      gURLBar.value = " " + message.data.selection;
   // gURLBar.focus();
      gURLBar.select();
	  gURLBar.selectionStart = 0;
	  gURLBar.selectionEnd = 0;
    }
  });
  gBrowser.selectedBrowser.messageManager.loadFrameScript(script, false);
I recently upgraded to FF109 from an older version, and it partially stopped working. It doesn't send text from textfields and input fields anymore, which often comes handy.

Anyone have and idea how to fix it?
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@avada

Is there an error in the browser console?

Do you have any test pages where the script fails?

It works for me on the Firefox 108 release build.

Test page
http://www.base64decode.org/

I don't have the Firefox 109 beta build installed at the moment.
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

morat wrote:@avada

Is there an error in the browser console?

Do you have any test pages where the script fails?

It works for me on the Firefox 108 release build.

Test page
http://www.base64decode.org/

I don't have the Firefox 109 beta build installed at the moment.
I don't see an error.

It doesn't seem to be site related. For example it doesn't work in the textfield I'm writing the comment into, but works text I selected in other comments.
"It works for me on the Firefox 108 release build."

No idea what went wrong.
How do you have the keyconfig then? Doesn't it only work on developer edition?

I did upgrade to "2018.2.108.2022.12.13-xiao" as well as dev edition 109b9. Also the latest loader.

No idea what went wrong. It's strange that there's no error.
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

I typed "test alpha beta gamma test" in the textarea element and highlighted the "alpha beta gamma" string and ran the script with the browser console.

Code: Select all

(function () {
  var script = "data:text/plain," + encodeURIComponent(`
    var data = {};
    data.selection = null;
    var selection = content.getSelection();
    if (selection.isCollapsed) {
      var element = content.document.activeElement;
      if (element instanceof HTMLTextAreaElement ||
          element instanceof HTMLInputElement &&
         (element.type ==     "text" ||
          element.type == "password" ||
          element.type ==    "email" ||
          element.type ==   "search" ||
          element.type ==      "tel" ||
          element.type ==      "url")) {
        var start = element.selectionStart;
        var end = element.selectionEnd;
        data.selection = element.value.substring(start, end);
      }
    } else {
      data.selection = selection.toString();
    }
    sendAsyncMessage("foobar", data);
  `);
  gBrowser.selectedBrowser.messageManager.addMessageListener("foobar", function removeMe(message) {
    gBrowser.selectedBrowser.messageManager.removeMessageListener("foobar", removeMe);
    if (message.data.selection) {
      gURLBar.value = " " + message.data.selection;
   // gURLBar.focus();
      gURLBar.select();
      gURLBar.selectionStart = 0;
      gURLBar.selectionEnd = 0;
    }
  });
  gBrowser.selectedBrowser.messageManager.loadFrameScript(script, false);
})();
I don't use xiaoxiaoflood keyconfig.
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

morat wrote:I typed "test alpha beta gamma test" in the textarea element and highlighted the "alpha beta gamma" string and ran the script with the browser console.

Code: Select all

(function () {
  var script = "data:text/plain," + encodeURIComponent(`
    var data = {};
    data.selection = null;
    var selection = content.getSelection();
    if (selection.isCollapsed) {
      var element = content.document.activeElement;
      if (element instanceof HTMLTextAreaElement ||
          element instanceof HTMLInputElement &&
         (element.type ==     "text" ||
          element.type == "password" ||
          element.type ==    "email" ||
          element.type ==   "search" ||
          element.type ==      "tel" ||
          element.type ==      "url")) {
        var start = element.selectionStart;
        var end = element.selectionEnd;
        data.selection = element.value.substring(start, end);
      }
    } else {
      data.selection = selection.toString();
    }
    sendAsyncMessage("foobar", data);
  `);
  gBrowser.selectedBrowser.messageManager.addMessageListener("foobar", function removeMe(message) {
    gBrowser.selectedBrowser.messageManager.removeMessageListener("foobar", removeMe);
    if (message.data.selection) {
      gURLBar.value = " " + message.data.selection;
   // gURLBar.focus();
      gURLBar.select();
      gURLBar.selectionStart = 0;
      gURLBar.selectionEnd = 0;
    }
  });
  gBrowser.selectedBrowser.messageManager.loadFrameScript(script, false);
})();
I don't use xiaoxiaoflood keyconfig.
Okay I tried copying the above into the console. Only got this:

Code: Select all

20:10:20.359
(function () {
  var script = "data:text/plain," + encodeURIComponent(`
    var data = {};
    data.selection = null;
    var selection = content.getSelection();…
20:10:20.378 undefined 
I tried via custom buttons as well, also doesn't work. So I guess soemthing is different in v109?
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

avada wrote:Only got this:
That's normal output.

Screenshot
http://imgur.com/iTlxO03

I tried to install the Firefox Portable 109 beta build, but the executable doesn't run on Windows 10 32-bit.

Thunderbird Test channel 64-bit only
http://portableapps.com/comment/249704#comment-249704

:evil:
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

morat wrote:
avada wrote:Only got this:
That's normal output.

Screenshot
http://imgur.com/iTlxO03

I tried to install the Firefox Portable 109 beta build, but the executable doesn't run on Windows 10 32-bit.

Thunderbird Test channel 64-bit only
http://portableapps.com/comment/249704#comment-249704

:evil:
I guess no error is raised by the browser. Still it's failing for some reason.

I also tried it in a new profile. It's the same.

PS: Beta 9 should be the same as release FF109, unless they find some issues.
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

Maybe the message listener isn't triggering correctly. If so, then I can't fix that.

Try running the following code snippets in the browser console.

1.

Does the url bar value change to "Hocus Pocus" string?

Code: Select all

gURLBar.value = "Hocus Pocus";
2.

Does the "Cowabunga" message appear in the browser console?

Code: Select all

gBrowser.selectedBrowser.messageManager.loadFrameScript(`data:application/javascript,console.log("Cowabunga")`, false);
Post Reply