MozillaZine

keyconfig 20110522

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

Post Posted March 19th, 2013, 7:17 am

nameanyone wrote: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?
That shortcut is handled by a keypress handler within the <tabbrowser> before it can reach a <key>.

You could try to build an extension handling that keypress event before the <tabbrowser> 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 KeyEvent.DOM_VK_F4:
   if(modifiers == "Control") {
    BrowserTryToCloseWindow();
    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.

firefoxuse
 
Posts: 1086
Joined: November 8th, 2011, 12:06 pm

Post Posted March 19th, 2013, 9:00 am

firefoxuse wrote:
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!!!


I paste this code to Custom Buttons addon to create a button, and it freezes my FF and it does nothing after all

any hint?

reevuur
 
Posts: 352
Joined: September 13th, 2004, 2:02 pm

Post Posted March 19th, 2013, 9:42 am

Today I installed keyconfig in thunderbird.
I want to change a few shortcuts in thunderbird (like gmail).

Every time I change some shortcut, click on APPLY, the new key is visible in the keyconfig window.
When I restart thunderbird the old keys are back again.

I tried also to change the keys in prefs.js with my text-editor (thunderbird is not opened).
Same thing.. I restart thunderbird and the old keys are back again.

Whats happening?

my OS = windows 8 pro
keyconfig = latest release
thunderbird = 17.0.4

WindHeight
 
Posts: 156
Joined: February 8th, 2008, 3:05 am

Post Posted March 21st, 2013, 2:39 pm

I am trying to find the latest version of this addon. Is it the 2011 version linked to in the OP?

JayhawksRock

User avatar
 
Posts: 10433
Joined: October 24th, 2010, 8:51 am

Post Posted March 21st, 2013, 2:46 pm

WindHeight wrote:I am trying to find the latest version of this addon. Is it the 2011 version linked to in the OP?

Good idea.. check and see.. :roll:
"The trouble with quotes on the internet is you never know if they are genuine" ...Abraham Lincoln

zoken
 
Posts: 4
Joined: October 17th, 2012, 10:29 pm

Post Posted March 21st, 2013, 3:11 pm

When you right-click on the back or forward buttons (or long-click on either), a menu of recent pages for that tab appears. These are the pages that the back and forward buttons would navigate you to. But, with that menu, you can first review, and then skip back or forward more than one page at a time, and/or cancel and not leave the current page at all.

Additionally, if you add the "Back/forward dropmarker" extension, a little arrow appears to the right of the buttons, that has the same effect.

I have been very interested in finding a way to assign a keyboard shortcut. Then, without wasting time with a mouse, I can quickly see the names of the recent pages I've navigated to in this tab, and cursor up/down and Enter if I want to go to one of them, or Escape if I don't. Opera had/has this keyboard shortcut, as something like Alt-Z.

Can this be accomplished using keyconfig? [-o<

Thanks!

WindHeight
 
Posts: 156
Joined: February 8th, 2008, 3:05 am

Post Posted March 21st, 2013, 7:12 pm

JayhawksRock wrote:
WindHeight wrote:I am trying to find the latest version of this addon. Is it the 2011 version linked to in the OP?

Good idea.. check and see.. :roll:

I found it surprising that a thread with so much activity could be from an addon that hasn't been updated in so long, so I asked because I thought maybe that the version in the OP is not the latest version, and mozilla addons doesn't always have the latest version (and often doesn't for fast moving addons).

tonymec

User avatar
 
Posts: 708
Joined: October 15th, 2004, 2:58 am
Location: Schaerbeek (near Brussels, Belgium)

Post Posted March 21st, 2013, 10:11 pm

WindHeight wrote:I found it surprising that a thread with so much activity could be from an addon that hasn't been updated in so long, so I asked because I thought maybe that the version in the OP is not the latest version, and mozilla addons doesn't always have the latest version (and often doesn't for fast moving addons).

Most of the activity in this thread is Q&A traffic about how to customize the extension, not bug reports about malfunctions. Keyconfig itself doesn't change often, but whenever it does, Dorando makes sure that the head post in this thread points to it. :-)
Best regards,
Tony

morat
 
Posts: 2715
Joined: February 3rd, 2009, 6:29 pm

Post Posted March 23rd, 2013, 9:00 am

@zoken

Try these:

Code: Select all
var popup = document.getElementById("backForwardMenu");
var anchor = document.getElementById("urlbar");
var position = "after_start";
var x = 0;
var y = 0;
var isContextMenu = true;
var attributesOverride = true;
popup.openPopup(anchor, position, x, y, isContextMenu, attributesOverride);

Code: Select all
var popup = document.getElementById("backForwardMenu");
var x = window.outerWidth / 4;
var y = window.outerHeight / 4;
var isContextMenu = true;
popup.openPopupAtScreen(x, y, isContextMenu);

https://developer.mozilla.org/en/XUL/Method/openPopup
https://developer.mozilla.org/en/XUL/Me ... upAtScreen
https://developer.mozilla.org/en/XUL/Po ... ositioning

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

Post Posted March 24th, 2013, 7:28 am

firefoxuse wrote:I paste this code to Custom Buttons addon to create a button, and it freezes my FF and it does nothing after all
Seems to work fine for me with Custom Buttons 0.0.5.5. Any steps to reproduce?

reevuur wrote:Every time I change some shortcut, click on APPLY, the new key is visible in the keyconfig window.
When I restart thunderbird the old keys are back again.

I tried also to change the keys in prefs.js with my text-editor (thunderbird is not opened).
Same thing.. I restart thunderbird and the old keys are back again.
Anything in the Error Console (Tools > Web Developer)? Do the entries disappear from prefs.js?
Support mozilla.dorando.at through donations/contributions.

Jonathan Pool
 
Posts: 6
Joined: October 14th, 2012, 11:48 am

Post Posted March 24th, 2013, 9:08 am

I can disable or change keyboard shortcuts generally, but, when I try to disable or change the shortcut for "Minimize" from Command-M, Thunderbird crashes every time.

Jonathan Pool
 
Posts: 6
Joined: October 14th, 2012, 11:48 am

Post Posted March 25th, 2013, 12:49 pm

Thunderbird does not obey my Copy and Paste shortcuts defined with Keyconfig when I have disabled the original meanings for the same keys.

zoken
 
Posts: 4
Joined: October 17th, 2012, 10:29 pm

Post Posted March 25th, 2013, 1:21 pm

Wow, morat, thanks for that! And it's nice to understand a bit better how this extension works.

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

Post Posted March 29th, 2013, 2:39 pm

Jonathan Pool wrote:I can disable or change keyboard shortcuts generally, but, when I try to disable or change the shortcut for "Minimize" from Command-M, Thunderbird crashes every time.
Based on this Crash Report, the crash happens in mac specific code and is somewhat similar to another crash mentioned in nsMenuX.mm.

You could try to open Tools > Error Console and enter the following (it should crash, but maybe it can give more insight):
Code: Select all
var targets = top.opener.Services.wm.getEnumerator(null); while(target = targets.getNext()) { var keyset = target.document.getElementById("baseMenuKeyset"); if(keyset) { while(keyset.parentNode && keyset.parentNode.localName == "keyset") keyset = keyset.parentNode; alert(target.location+"\n"+keyset.id+"\n"+keyset.childElementCount); keyset.parentNode.insertBefore(keyset, keyset.nextSibling); } } alert("Done");

Jonathan Pool wrote:Thunderbird does not obey my Copy and Paste shortcuts defined with Keyconfig when I have disabled the original meanings for the same keys.
Those <key>s have (in most windows) no attached code and only exist so they can appear in the menu (the actual handling happens at a different place in the code).

You can Add a new key containing:
Code: Select all
goDoCommand("cmd_copy"); 
and one containing:
Code: Select all
goDoCommand("cmd_paste"); 
if you want to assign a different shortcut to those functions.
Support mozilla.dorando.at through donations/contributions.

opredeleno
 
Posts: 1
Joined: March 30th, 2013, 7:35 pm

Post Posted March 31st, 2013, 9:32 am

dorando wrote:
mad.engineer wrote:I'm hoping if you could provide me the code that I can use via Keyconfig to do a "Save All" in the TB message attachment window?.
Try
Code: Select all
HandleAllAttachments('save'); 


this is hands down the most useful command ever. I registered here just to find it and say a big THANKS! Dorando, your app is amazing. It is not quite user friendly for someone like me, but this thread and you *are*!

Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 0 guests