keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
Post Reply
mad.engineer
Posts: 314
Joined: August 8th, 2006, 4:08 pm

Re: keyconfig 20110522

Post by mad.engineer »

dorando, morat:

I've assigned the following code for the 'Send Now' function that you provided a while back, in TB 17.0.3, OS X:

var nsIPromptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);

var flags =
nsIPromptService.BUTTON_POS_0 * nsIPromptService.BUTTON_TITLE_IS_STRING +
nsIPromptService.BUTTON_POS_1 * nsIPromptService.BUTTON_TITLE_IS_STRING;

if(nsIPromptService.confirmEx(null, "Send Now", "Do you want to send (Y/N)?", flags, "&Yes", "&No", null, null, {}) == 0)
goDoCommand("cmd_sendNow");


Lately, I've noticing the following in the Error Console, though this error occasionally show up [The Send Now itself is working OK though]:

Timestamp: 2/22/13 9:35:43 AM
Error: An error occurred executing the cmd_sendNow command: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIMsgCompose.SetDocumentCharset]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: chrome://messenger/content/messengercompose/MsgComposeCommands.js :: SetDocumentCharacterSet :: line 2467" data: no]
Source File: chrome://global/content/globalOverlay.js
Line: 79

wondering if the above error has anything to do with the Keyconfig code that I've listed above?. This is just my guess since it is referencing "An error occurred executing the cmd_sendNow command". Can you please advise. Thanks
Wild Things Games
Posts: 1
Joined: February 22nd, 2013, 5:13 pm

Re: keyconfig 20110522

Post by Wild Things Games »

First of all Dorando, this Keyconfig extension will solve (if I can get it to work) a -massive- problem I've had with Thunderbird 17.0.3.

Let me apologize, I haven't had the time to scan through the entire 165 page thread for this and if I've missed the answer to my issue sorry to bother you for a direct link.

Downloaded the extension from here: http://mozilla.dorando.at/

The extension auto directed the installation to Firefox, but I'm not finding the magic series of motions to get it to install properly to Thunderbird 17.0.3.

Though I am a novice with this sort of thing, I like to think I've figured out my share of coding/extension issues in my time, however, I did register at mozillaZine's forum simply to ask if you can make help me with the Mark Replied/Unmark replied code work.

Code: Select all

user_pref("keyconfig.main.xxx_key__Mark Msg Answered", "!][][][var hdr=GetDBView().hdrForFirstSelectedMessage; hdr.folder.addMessageDispositionState(hdr, 0);;");
user_pref("keyconfig.main.xxx_key__Mark Msg Answered", "!][][][var hdr=GetDBView().hdrForFirstSelectedMessage; GetDBView().db.MarkHdrReplied(hdr,true,null);");


I didn't see a way to install the extension directly to TB, but when I saved the pref.js file and reopened TB, it did say something was installing.

The issue I'm having is, though I can see the Keyconfig extention within Firefox Addons tab with the options accessible, the "Keyconfig" option within TB (both under Tools and within the Addons tab; ctrl + shift + F12 is not bringing up the options either) does not appear. (I have also turned off the system and rebooted with no luck)

If you can help, I would be very much in your debt.

Thanks,

Jeramy
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20110522

Post by dorando »

Hamid_Y2K wrote:colt addon
please code for tab context menu copy URI > Simple URI and Page Title and URI
Try

Code: Select all

Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.
getService(Components.interfaces.nsIClipboardHelper)
.
copyString(content.location); 
and

Code: Select all

Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.
getService(Components.interfaces.nsIClipboardHelper)
.
copyString(content.document.title " - " content.location); 

mad.engineer wrote:Lately, I've noticing the following in the Error Console, though this error occasionally show up [The Send Now itself is working OK though]:

Timestamp: 2/22/13 9:35:43 AM
Error: An error occurred executing the cmd_sendNow command: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIMsgCompose.SetDocumentCharset]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: chrome://messenger/content/messengercompose/MsgComposeCommands.js :: SetDocumentCharacterSet :: line 2467" data: no]
Source File: chrome://global/content/globalOverlay.js
Line: 79

wondering if the above error has anything to do with the Keyconfig code that I've listed above?
Assumable, but the same error should happen with File > Send Now.

Wild Things Games wrote:The extension auto directed the installation to Firefox, but I'm not finding the magic series of motions to get it to install properly to Thunderbird 17.0.3.
In the Browser: Context Menu > Save Link As…
In Thunderbird: Tools > Add-ons > Button next to the Search box > Install Add-on From File…
Support mozilla.dorando.at through donations/contributions.
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Re: keyconfig 20110522

Post by Zoolcar9 »

dorando wrote:
Wild Things Games wrote:The extension auto directed the installation to Firefox, but I'm not finding the magic series of motions to get it to install properly to Thunderbird 17.0.3.
In the Browser: Context Menu > Save Link As…
In Thunderbird: Tools > Add-ons > Button next to the Search box > Install Add-on From File…

You can also drag keyconfig.xpi link from Firefox window onto Add-ons Manager in Thunderbird window.
My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
Hamid_Y2K
Posts: 20
Joined: July 8th, 2010, 4:59 am

Re: keyconfig 20110522

Post by Hamid_Y2K »

dorando wrote:
Hamid_Y2K wrote:colt addon
please code for tab context menu copy URI > Simple URI and Page Title and URI
Try

Code: Select all

Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.
getService(Components.interfaces.nsIClipboardHelper)
.
copyString(content.location); 
and

Code: Select all

Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.
getService(Components.interfaces.nsIClipboardHelper)
.
copyString(content.document.title + " - " + content.location); 


Thank you Dorando :oops:
but "page title and url" is copying in one row.
If it is possible copying like below:
page title
url
keyconfig 20110522 • mozillaZine Forums
viewtopic.php?

thanks :)
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Re: keyconfig 20110522

Post by Zoolcar9 »

Hamid_Y2K wrote: but "page title and url" is copying in one row.
If it is possible copying like below:
page title
url
keyconfig 20110522 • mozillaZine Forums
http://forums.mozillazine.org/viewtopic.php

Replace " - " with "\n"
My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
cheater00
Posts: 1
Joined: February 25th, 2013, 2:31 am

Re: keyconfig 20110522

Post by cheater00 »

Hi dorando!
I have been using your excellent plugin to make a binding to cycle tabs. F1 is previous tab, F2 is next tab. However, on some pages those keys get caught out. For example, on Google Spreadsheet, F2 is defined to be "edit spreadsheet cell" and that takes precedence over what I set in keyconfig. I guess that keyconfig somehow uses the top level dom element to set its bindings, whereas the website catches the key press event somewhere further down the tree. Can you help me configure keyconfig so that it takes precedence over those websites? I really hate google for that key combo now, because I can't turn it off :)
Hamid_Y2K
Posts: 20
Joined: July 8th, 2010, 4:59 am

Re: keyconfig 20110522

Post by Hamid_Y2K »

Zoolcar9 wrote:
Hamid_Y2K wrote: but "page title and url" is copying in one row.
If it is possible copying like below:
page title
url
keyconfig 20110522 • mozillaZine Forums
http://forums.mozillazine.org/viewtopic.php

Replace " - " with "\n"


Thank you Zoolcar9 :) =D>
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20110522

Post by dorando »

cheater00 wrote:Can you help me configure keyconfig so that it takes precedence over those websites?
Currently not possible, see Bug 380637 - Should web pages be able to override the browser's keyboard shortcuts?.

You could try to build an extension handling keypress events before they reach the content by opening your Profile and create within the extensions folder a folder named userxul@nobody containing:

install.rdf

Code: Select all

<?xml version="1.0"?>
<rdf:RDF
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns="http://www.mozilla.org/2004/em-rdf#">

 <rdf:Description rdf:about="urn:mozilla:install-manifest">
  <id>userxul@nobody</id>
  <name>User XUL</name>
  <version>0</version>

  <targetApplication><rdf:Description>
   <id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id>
   <minVersion>1.0+</minVersion>
   <maxVersion>*</maxVersion>
  </rdf:Description></targetApplication>

 </rdf:Description>
</rdf:RDF>
chrome.manifest

Code: Select all

content userxul .
overlay chrome://browser/content/browser.xul chrome://userxul/content/browser.xul 
browser.xul

Code: Select all

<?xml version="1.0"?>

<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script type="application/javascript"><![CDATA[ window.addEventListener("keypress", function (event){
 var modifiers = ["Alt","Control","Meta","Shift","OS"]
 .filter(event.getModifierState, event).join(" ");

 switch(event.keyCode) {
  case KeyboardEvent.DOM_VK_F1:
   if(modifiers == "") {
    gBrowser.tabContainer.advanceSelectedTab(-1,true);
    event.preventDefault();
    event.stopPropagation();
   }
  break;

  case KeyboardEvent.DOM_VK_F2:
   if(modifiers == "") {
    gBrowser.tabContainer.advanceSelectedTab(1,true);
    event.preventDefault();
    event.stopPropagation();
   }
  break;
 }

},true); ]]></script>

</overlay>
(note that the files should not contain any space at the start).
Support mozilla.dorando.at through donations/contributions.
nameanyone
Posts: 22
Joined: February 14th, 2007, 10:54 am

Re: keyconfig 20110522

Post by nameanyone »

Would like to remap Ctrl-F4 to close a window instead of a tab. How do I disable the Firefox's bulit-in Ctrl-F4 handling?
firefoxuse
Posts: 1086
Joined: November 8th, 2011, 12:06 pm

Re: keyconfig 20110522

Post by firefoxuse »

firefoxuse wrote:is there a code to "close duplicate tabs" ???

thanks!


morat wrote:@firefoxuse

Try this:

Code: Select all

// remove all duplicate tabs
a:for (var i = 0; i < gBrowser.tabContainer.childNodes.length; i++) {
  for (var j = 0; j < gBrowser.tabContainer.childNodes.length; j++) {
    var m = gBrowser.tabContainer.childNodes[i].linkedBrowser.currentURI.spec;
    var n = gBrowser.tabContainer.childNodes[j].linkedBrowser.currentURI.spec;
    if (i != j && j != gBrowser.tabContainer.selectedIndex && m == n) {
      gBrowser.removeTab(gBrowser.tabContainer.childNodes[j]);
      i = i - 1; continue a;
    }
  }
}


is there a way to have a button for this???

thanks!!!
morat
Posts: 6432
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

firefoxuse wrote:Is there a way to have a button for this?

No. The keyconfig extension allows you to create shortcuts, not buttons.
User avatar
WildcatRay
Posts: 7486
Joined: October 18th, 2007, 7:03 pm
Location: Columbus, OH

Re: keyconfig 20110522

Post by WildcatRay »

Isn't there a custom buttons addon?
Ray

OS'es: 4 computers with Win10 Pro 64-bit; Current Firefox, Beta, Nightly, Chrome, Vivaldi
firefoxuse
Posts: 1086
Joined: November 8th, 2011, 12:06 pm

Re: keyconfig 20110522

Post by firefoxuse »

WildcatRay wrote:Isn't there a custom buttons addon?


is there? which one?
User avatar
WildcatRay
Posts: 7486
Joined: October 18th, 2007, 7:03 pm
Location: Columbus, OH

Re: keyconfig 20110522

Post by WildcatRay »

firefoxuse wrote:
WildcatRay wrote:Isn't there a custom buttons addon?


is there? which one?

Try searching for "custom buttons" on addons.mozilla.org.
Ray

OS'es: 4 computers with Win10 Pro 64-bit; Current Firefox, Beta, Nightly, Chrome, Vivaldi
Post Reply