keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
Post Reply
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

retepmu wrote:I like to use a shortcut, which executes a sequence of commands of different contexts.

Example for such a task:
"The user knows that he will reply (in the future), but he has no time (at the moment) to write the message immediately. He uses the (content of the) sent folder as a reminder."

Code: Select all

goDoCommand("cmd_reply");
goDoCommand("cmd_saveAsDraft");
goDoCommand("cmd_close");
goDoCommand("cmd_nextUnreadMsg");


That code executes only the function of the first line.

My question:
The first line needs the context "main window".
The second a third line need the context "draft window", while the fourth line again needs the context "main window".

How can I realize a shortcut for the described task please?
Try

Code: Select all

var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.
getService(Components.interfaces.nsIWindowMediator);

var Listener = {
 onWindowTitleChange: function(){}, onCloseWindow: function(){},
 onOpenWindow: function(aWindow){
  wm.removeListener(this);

  this.compose = aWindow.docShell
  
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
  .getInterface(Components.interfaces.nsIDOMWindow);

  this.compose.addEventListener("compose-window-init", this, true);
 },
 handleEvent: function(event){
  event.currentTarget.removeEventListener(event.type, this, true);
  event.currentTarget.gMsgCompose.RegisterStateListener(Listener);
 },
 NotifyComposeFieldsReady: function() {},
 NotifyComposeBodyReady: function() {
  this.compose.gMsgCompose.UnregisterStateListener(this);
  this.compose.window.setTimeout(function(){
   this.goDoCommand("cmd_saveAsDraft");
   this.goDoCommand("cmd_close");
   goDoCommand("cmd_nextUnreadMsg");
  },0);
 }
}

wm.addListener(Listener);

goDoCommand("cmd_reply"); 

jerdna wrote:hi, my shortcut for panorama (ctrl+spacebar) doesnt work... can you please tell me how can i change that short cut into alt+spacebar or F1.
You can't change the existing shortcut since it has been implemented as an EventListener instead of a <key>, but you can Add a new key containing

Code: Select all

TabView.toggle();  
but if the original shortcut fails, this might too.
retepmu
Posts: 229
Joined: December 21st, 2002, 5:41 pm
Location: Berlin, Germany
Contact:

Re: keyconfig 20080929

Post by retepmu »

dorando wrote:Try

Code: Select all

var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.
getService(Components.interfaces.nsIWindowMediator);

var Listener = {
 onWindowTitleChange: function(){}, onCloseWindow: function(){},
 onOpenWindow: function(aWindow){
  wm.removeListener(this);

  this.compose = aWindow.docShell
  
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
  .getInterface(Components.interfaces.nsIDOMWindow);

  this.compose.addEventListener("compose-window-init", this, true);
 },
 handleEvent: function(event){
  event.currentTarget.removeEventListener(event.type, this, true);
  event.currentTarget.gMsgCompose.RegisterStateListener(Listener);
 },
 NotifyComposeFieldsReady: function() {},
 NotifyComposeBodyReady: function() {
  this.compose.gMsgCompose.UnregisterStateListener(this);
  this.compose.window.setTimeout(function(){
   this.goDoCommand("cmd_saveAsDraft");
   this.goDoCommand("cmd_close");
   goDoCommand("cmd_nextUnreadMsg");
  },0);
 }
}

wm.addListener(Listener);

goDoCommand("cmd_reply"); 


I tried, and it worked perfectly.

If you visit Berlin some day, please let me know. If you like, I invite you for a drink. :) That's not a phrase.

Thanks for your help, Dorando.
Andreas
Version of TB or FF used by me: the actual one
My tip collections for Thunderbird and Firefox (both in german language)
mad.engineer
Posts: 314
Joined: August 8th, 2006, 4:08 pm

Re: keyconfig 20080929

Post by mad.engineer »

Could you please update keyconfig to make it compatible with TB 3.1.3?. Thank you.
Amsuke
Posts: 60
Joined: April 3rd, 2010, 8:23 am

Re: keyconfig 20080929

Post by Amsuke »

The Firefox update that just got released lists KeyConfig and MenuManipulator as being not compatible. Any chance you could update them?
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

Compatibility information has been updated, it might be necessary to click on Tools > Add-ons > Find Updates (which might incorrectly state at the top that "No updates were found" while "A compatibility update has been applied" as stated below the extension name) if the extensions didn't got re-enabled already.

Note that it is possible to disable the compatibility enforcing by adding a boolean 'extensions.checkCompatibility.3.6' (Firefox 3.6) or 'extensions.checkCompatibility.3.1' (Thunderbird 3.1) through about:config.
iklmn
Posts: 2
Joined: May 25th, 2010, 4:33 am

Re: keyconfig 20080929

Post by iklmn »

thank you, dorando! update is working
retepmu
Posts: 229
Joined: December 21st, 2002, 5:41 pm
Location: Berlin, Germany
Contact:

Re: keyconfig 20080929

Post by retepmu »

I have a problem with self build shortcuts in Firefox (3.6.9).

1
A shortcut for the use of firebug:

Code: Select all

goDoCommand("cmd_toggleInspecting")


2
A shortcut for the print preview:

Code: Select all

goDoCommand("cmd_printPreview")


I assigned a shortcut to each of it, which is not used by other commands yet.

But both do not work.

Any ideas?

Thank you.
Andreas
Version of TB or FF used by me: the actual one
My tip collections for Thunderbird and Firefox (both in german language)
nameanyone
Posts: 22
Joined: February 14th, 2007, 10:54 am

Re: keyconfig 20080929

Post by nameanyone »

nameanyone wrote:How can I make these titles stick between the restarts?
Oh, and how do I "unwatch" the title, i.e. go back to the default behavior of tracking the current tab?

dorando wrote:You might want to build a custom extension with http://dev.dorando.at/mozilla/blank.xpi as a base and add above the </overlay> in the main.xul ( look for it within Profile/extensions/userxul@nobody/overlays/ after restating Firefox) the following code:

Code: Select all

<script type="text/javascript"><![CDATA[

 var userXUL = {
  ss: Components.classes["@mozilla.org/browser/sessionstore;1"].getService(Components.interfaces.nsISessionStore),
  observe: function(subject, topic, data) {
   Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService)
   .removeObserver(this, "sessionstore-windows-restored");

   var title = this.ss.getWindowValue(window, "userXUL-title");
   if(title) {
    document.title = title;
    document.watch("title", function(){ return this.title; });
   }
  },
  title_on: function() {
   var title = prompt("Set the window title to:",document.title);
   if (!title||!title.trim().length) return;
   document.unwatch("title");
   document.title = title;
   document.watch("title", function(){ return this.title; });
   this.ss.setWindowValue(window, "userXUL-title", title);
  },
  title_off: function() {
   document.unwatch("title");
   this.ss.deleteWindowValue(window, "userXUL-title");
   gBrowser.updateTitlebar();
  }
 }

 Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService)
 .addObserver(userXUL, "sessionstore-windows-restored", false);

]]>
</script>

<keyset>
 <key id="userXUL-title-on" modifiers="control shift" key="O" oncommand="userXUL.title_on();" />
 <key id="userXUL-title-off" modifiers="control shift" key="U" oncommand="userXUL.title_off();" />
</keyset>


Thanks, dorando, the code works, mostly. Two problems:
1. The title does not get changed right away, only after a restart.EDIT:I fixed this by putting my code back:

Code: Select all

/*
   document.unwatch("title");
   document.title = title;
   document.watch("title", function(){ return this.title; });
*/
document.watch("title", function(){return title;});
document.title = title;

2. It doesn't work for the last of several windows. If I close that window, on the next restart the window that is now the last will lose it's title. (By "last" I mean the rightmost in Windows taskbar).
sridhar
Posts: 184
Joined: June 18th, 2004, 2:54 pm
Contact:

Re: keyconfig 20080929

Post by sridhar »

I have currently 't' set to open a new tab in Firefox.

Is it possible for this keypress to send the selected/current conversation(s) to trash when in Gmail tab? The standard hotkey for this is hash (#).
fcassia2008
Posts: 5
Joined: December 9th, 2007, 3:34 am
Location: Buenos Aires, Argentina
Contact:

Re: keyconfig 20080929

Post by fcassia2008 »

Doesn´t work with SeaMonkey 2.0.6.

Any particular reason for it not working? Or do I have to open the xpi and look for the maxversion parameter and tweak it?.

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

Re: keyconfig 20080929

Post by dorando »

retepmu wrote:A shortcut for the use of firebug
Try

Code: Select all

Firebug.toggleBar();   
retepmu wrote:A shortcut for the print preview
Try

Code: Select all

PrintUtils.printPreview(onEnterPrintPreview, onExitPrintPreview);   

You can get the code for menuitems with

Code: Select all

function getCommand(event) {
 window.removeEventListener("command", arguments.callee, true);
 event.preventDefault();
 event.stopPropagation();

 alert(event.target.getAttribute("oncommand") || event.target.getAttribute("onclick"));
}

window.addEventListener("command", getCommand, true);   


nameanyone wrote:Two problems:
1. The title does not get changed right away, only after a restart.[...]
2. It doesn't work for the last of several windows. If I close that window, on the next restart the window that is now the last will lose it's title. (By "last" I mean the rightmost in Windows taskbar).
Both work fine for me (assuming only the included shortcuts are used). How do you close Firefox (File > Exit, shortcut, or some other way)?

sridhar wrote:I have currently 't' set to open a new tab in Firefox.

Is it possible for this keypress to send the selected/current conversation(s) to trash when in Gmail tab? The standard hotkey for this is hash (#).
Something like

Code: Select all

if(content.location.host == "mail.google.com") {
 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
 getInterface(Components.interfaces.nsIDOMWindowUtils);

 utils.sendKeyEvent("keypress", 0, "#".charCodeAt(0), 0);
}
 else {
 BrowserOpenTab();
}
   
might work.

fcassia2008 wrote:Doesn´t work with SeaMonkey 2.0.6.

Any particular reason for it not working? Or do I have to open the xpi and look for the maxversion parameter and tweak it?.
The Add-on Manager seems to be still broken, you need to click Tools > Add-on Manager > Find Updates to retrieve the current compatibility information and restart SeaMonkey.
nameanyone
Posts: 22
Joined: February 14th, 2007, 10:54 am

Re: keyconfig 20080929

Post by nameanyone »

dorando wrote:Both work fine for me (assuming only the included shortcuts are used). How do you close Firefox (File > Exit, shortcut, or some other way)?

Yes, using included shortcuts, and Yes, File > Exit. Must be some other extension interfering. I'll try to find out which one. Maybe it's Session Manager.
retepmu
Posts: 229
Joined: December 21st, 2002, 5:41 pm
Location: Berlin, Germany
Contact:

Re: keyconfig 20080929

Post by retepmu »

dorando wrote:

Code: Select all

Firebug.toggleBar();   

Code: Select all

PrintUtils.printPreview(onEnterPrintPreview, onExitPrintPreview);   

Both work fine. Thanks :)
dorando wrote:You can get the code for menuitems with

Code: Select all

function getCommand(event) {
 window.removeEventListener("command", arguments.callee, true);
 event.preventDefault();
 event.stopPropagation();

 alert(event.target.getAttribute("oncommand") || event.target.getAttribute("onclick"));
}

window.addEventListener("command", getCommand, true);   

Hhmm. I do not know how to use that method.
I created a shortcut with that code.
When I start it, the first entry of the menubar is marked.

When I choose a command (with the keyboard or with the mouse) I cannot recognize where the code is put out.
It is not in the clipboard e.g.

Could you please give me a hint? Thanks.
Andreas
Version of TB or FF used by me: the actual one
My tip collections for Thunderbird and Firefox (both in german language)
sridhar
Posts: 184
Joined: June 18th, 2004, 2:54 pm
Contact:

Re: keyconfig 20080929

Post by sridhar »

dorando wrote:
sridhar wrote:I have currently 't' set to open a new tab in Firefox.

Is it possible for this keypress to send the selected/current conversation(s) to trash when in Gmail tab? The standard hotkey for this is hash (#).
Something like

Code: Select all

if(content.location.host == "mail.google.com") {
 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
 getInterface(Components.interfaces.nsIDOMWindowUtils);

 utils.sendKeyEvent("keypress", 0, "#".charCodeAt(0), 0);
}
 else {
 BrowserOpenTab();
}
   
might work.


I tried this code and found it to not work. Pressing 't' does not do anything when in Gmail tab. It continues to open a new tab when in any other tab as expected. If it matters, the URL in the address bar when in Gmail starts with https://mail.google.com/mail/

Also I use a laptop and to press #, I have to hold the shift key down and hit the '3' key. So perhaps the above code should be modified to replace "#" with "shift + 3"?

As always, thanks for your wonderful help?
JPNL
Posts: 16
Joined: November 16th, 2007, 7:38 am

How to change or disable the CTRL+B shortcut for bookmarks

Post by JPNL »

Hello,

How can you disable (or change) the CTRL+B bookmark? This opens the sidebar but I don't want that because this shortcut is also used to make selected text bold in a rich text editor (e.g. SalesForce CRM, Dynamics CRM).

How can I change (or else disable) this shortcut from being used or 'stolen' by Firefox?

I started a topic with this question in 2007 but that topic is locked while there is no answer yet.
viewtopic.php?f=38&t=603912

I found a post in the KB and several other websites refering to the keyconfig addon, but that is from 2008 and not listed on the official firefox addon page so I don't want to use it for security reasons.
Thanks
JP
Post Reply