MozillaZine

keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
goldmember
 
Posts: 10
Joined: July 4th, 2007, 2:50 am

Post Posted September 14th, 2010, 10:34 am

Anyone have Keyconfig working on Firefox 4.0 beta 5?

I have it working perfectly in 4.0b1, but every beta since has broken Keyconfig functionality for me, even with with checkCompat disabled. By "broken" I mean that the Keyconfig window loads but it's completely blank. When I revert to 4.0b1, all my shortcuts come back. Any ideas?

konrad79
 
Posts: 23
Joined: February 10th, 2009, 5:19 am

Post Posted September 16th, 2010, 5:09 am

After the recent update, keyconfig 20080929 is no longer compatible with Firefox 3.6.10.
I disabled the compatibility checking but it still throws the "Not compatible" error in the AddOn window.

sridhar
 
Posts: 184
Joined: June 18th, 2004, 2:54 pm

Post Posted September 16th, 2010, 5:36 am

I used MR Tech Toolkit add-on to force compatibility of keyconfig and functions for keyconfig add-ons and they are working fine in the latest Firefox.

Amsuke
 
Posts: 60
Joined: April 3rd, 2010, 8:23 am

Post Posted September 16th, 2010, 5:55 am

dorando wrote:
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.




Thanks, dorando. However, it looks like a new version of Firefox just came out, and these two add-ons need to be updated again. Would it be easier to just mark them as compatible up to something like 3.9?


dorando wrote:
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.




I don't like to do this in general, as it can cause problems. I'll do it on a temporary basis only. Thanks for the tip, though!

adulttw
 
Posts: 63
Joined: July 3rd, 2004, 10:46 pm

Post Posted September 16th, 2010, 6:27 pm

Is there any new version for firefox4??
Thx...

bruc2y
 
Posts: 8
Joined: August 31st, 2007, 12:51 pm
Location: Canada

Post Posted September 17th, 2010, 9:44 am

Everybody,

I do not have the compatibility checking boolean and did not want to add it in about:config. So, I downloaded keyconfig.xpi to my desktop, opened it with 7-zip (it is compressed) and opened install.rdf with notepad. I found the max version and changed it to the following:

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

It works.

Save the file into the archive. Drag and drop it into the Tools/Add-on window to install it. It even kept my custom configurations in keyconfig, ones I use for my mouse, F2 and F3 (forward and back through multiple open tabs).

Cheers!

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

Post Posted September 19th, 2010, 6:29 am

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.

nameanyone wrote:
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)?
Must be some other extension interfering. I'll try to find out which one. Maybe it's Session Manager.
Yep, Session Manager 0.6.8.3 does also use document.watch which seems to be called after userXUL.observe for the last window (only one watch per property, the last one wins), and unwatch seems to be unreliable, so try the following instead
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");

   this.title = this.ss.getWindowValue(window, "userXUL-title");
   if(this.title)
    window.setTimeout(function(watcher){ document.watch("title", watcher); document.title = 0; },0,this.watcher);
  },
  watcher: function(id, oldVal, newVal){
   return userXUL.title || com.morac.gSessionManagerWindowObject.updateTitlebar(id, oldVal, newVal);
  },
  title_on: function() {
   var title = prompt("Set the window title to:",document.title);
   if (!title||!title.trim().length) return;

   this.title = title;
   document.watch("title", this.watcher);
   this.ss.setWindowValue(window, "userXUL-title", title);
   gBrowser.updateTitlebar();
  },
  title_off: function() {
   this.ss.deleteWindowValue(window, "userXUL-title");
   delete this.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>

retepmu wrote:I created a shortcut with that code.
When I start it, the first entry of the menubar is marked.
Nothing in there should be able to cause that, maybe something is interfering.

sridhar wrote: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"?
Try
Code: Select all
if(content.location.host == "mail.google.com") {
 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
 getInterface(Components.interfaces.nsIDOMWindowUtils);

 utils.sendKeyEvent("keydown", KeyEvent.DOM_VK_3, 0, Event.SHIFT_MASK);
 utils.sendKeyEvent("keypress", 0, "#".charCodeAt(0), Event.SHIFT_MASK);
 utils.sendKeyEvent("keyup", KeyEvent.DOM_VK_3, 0, Event.SHIFT_MASK);
}
 else {
 BrowserOpenTab();
}
  

JPNL wrote: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?
Their rich text editor assumable doesn't support that shortcut (in Firefox) since I can use Ctrl+B with TinyMCE, WYMeditor, NicEdit, and CKEditor without problems.
JPNL wrote: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.
:roll:

goldmember wrote:Anyone have Keyconfig working on Firefox 4.0 beta 5?
See the reply to stevvie.

retepmu
 
Posts: 229
Joined: December 21st, 2002, 5:41 pm
Location: Berlin, Germany

Post Posted September 19th, 2010, 7:22 am

dorando wrote:
retepmu wrote:I created a shortcut with that code.
When I start it, the first entry of the menubar is marked.
Nothing in there should be able to cause that, maybe something is interfering.

Hhmm.
What should happen, if the shortcut with your code works correctly, please?

Your wrote "You can get the code for menuitems with ...".

In which form should the code appear?
Andreas
Version of TB or FF used by me: the actual one
My tip collections for Thunderbird and Firefox (both in german language)

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

Post Posted September 21st, 2010, 10:25 am

An alert box would appear after you've activated a menuitem.

retepmu
 
Posts: 229
Joined: December 21st, 2002, 5:41 pm
Location: Berlin, Germany

Post Posted September 21st, 2010, 10:38 am

dorando wrote:An alert box would appear after you've activated a menuitem.

Hhmm.
No alert box appears, after these two steps:
1 F10 (see screenshot, that is the shortcut for the command)
2 Mausklick on Menu "Datei > Neues Tab" (File > New Tab)

http://borumat.de/+screenshots/hc-2010. ... _34_19.png

If you have any idea, what could have went wrong, please let me know.
Andreas
Version of TB or FF used by me: the actual one
My tip collections for Thunderbird and Firefox (both in german language)

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

Post Posted September 21st, 2010, 11:27 am

F10 can't currently be used (nor disabled) with keyconfig since it is handled by either Windows or the menubar before it reaches the key handler.

retepmu
 
Posts: 229
Joined: December 21st, 2002, 5:41 pm
Location: Berlin, Germany

Post Posted September 21st, 2010, 1:25 pm

Thanks, Dorando. The F10 was the cause. With another shortcut it works fine.
Andreas
Version of TB or FF used by me: the actual one
My tip collections for Thunderbird and Firefox (both in german language)

gwhtech
 
Posts: 3
Joined: September 22nd, 2010, 4:31 pm

Post Posted September 22nd, 2010, 4:37 pm

I'm trying to get keyconfig working with the latest version of Thunderbird with no success. I can disable the key commands and they disappear (apply, close), but the key sequences still do the same thing. Does anyone have this working anywhere?

tonymec

User avatar
 
Posts: 731
Joined: October 15th, 2004, 2:58 am
Location: Ixelles (Brussels Capital Region, Belgium)

Post Posted September 23rd, 2010, 10:11 pm

goldmember wrote:Anyone have Keyconfig working on Firefox 4.0 beta 5?

AFAIK, such a version of keyconfig doesn't exist yet. There have been huge changes (and more are coming) in the way Toolkit 2.0 beta (Firefox 4.0 beta, SeaMonkey 2.1 pre-beta, Thunderbird 3.3 pre-alpha, etc.) interacts with extensions. I suppose Dorando can't be blamed for waiting until the backend stabilizes, but of course this leaves all of us trunk testers out in the cold.
Best regards,
Tony

jek60
 
Posts: 14
Joined: March 9th, 2009, 10:17 am

Post Posted September 24th, 2010, 3:40 pm

Every couple of years (this time because Thunderbird updated to 3.1.x) I have to go back and re-figure out how to get Emacs keybindings working.

I updated keyconfig and re-ran the python script to modify the keybindings (see end for content of the script).

But I find that the editor binding in messages works for all key bindings except ctl-B and ctl-U. Both of these are intercepted and bold and underline functions are used instead of the explicit binding of:
Code: Select all
  <binding id="editor">
    <handlers>
    <!-- Emacsish single-line motion and delete keys -->
    <handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/>
    <handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
    <handler event="keypress" id="key_left" key="b" modifiers="control" command="cmd_charPrevious"/>
    <handler event="keypress" id="key_right" key="f" modifiers="control" command="cmd_charNext"/>
...


Any idea why the "b" and "u" key bindings don't work in the edit panel?

Here is the python script for editing the toolkit.jar file:

Code: Select all
#!/usr/bin/env python
# python addemacsbindings.py 'Mozilla Firefox'
# python addemacsbindings.py 'Mozilla Thunderbird'

import sys
import zipfile
import shutil
import time
import re

if (len(sys.argv) != 2):
    print "Usage: %s <App_name>" % (sys.argv[0]);
    print "\nThis script will add the Emacs keybindings to <App_name>'s toolkit.jar"
    print "file.  It assumes that the <App_name> appliation is Firefox, Thunderbird, "
    print "or one of the other Mozilla-based applications that has a "
    print "/Applications/<App_name>.app/Contents/MacOS/chrome/toolkit.jar file."
    sys.exit(1)

# text to add
bindings = """
    <!-- Emacsish single-line motion and delete keys -->
    <handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/>
    <handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
    <handler event="keypress" id="key_left" key="b" modifiers="control" command="cmd_charPrevious"/>
    <handler event="keypress" id="key_right" key="f" modifiers="control" command="cmd_charNext"/>
    <handler event="keypress" id="key_delback" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
    <handler event="keypress" id="key_delforw" key="d" modifiers="control" command="cmd_deleteCharForward"/>
    <handler event="keypress" id="key_delwback" key="w" modifiers="control" command="cmd_deleteWordBackward"/>
    <handler event="keypress" id="key_del_bol" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/>
    <handler event="keypress" id="key_del_eol" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/>

    <!-- Emacsish multi-line motion and delete keys -->
    <handler event="keypress" id="key_linedown" key="n" modifiers="control" command="cmd_lineNext"/>
    <handler event="keypress" id="key_lineup" key="p" modifiers="control" command="cmd_linePrevious"/>"""

# path to the app
IsCygwin = True
if IsCygwin:
    # Mozilla Firefox/chrome/toolkit.jar
    # Mozilla Thunderbird/chrome/toolkit.jar
    # mozilla.org/Mozilla/chrome/toolkit.jar
    apppath = "/cygdrive/c/Program Files/%s/chrome" % (sys.argv[1])
else:
    apppath = "/Applications/%s.app/Contents/MacOS/chrome" % (sys.argv[1])
if 0:
    apppath = "."

# create the string for toolkit.jar
zipfilename = apppath + "/toolkit.jar"

# make sure this is the correct type of file
if not zipfile.is_zipfile(zipfilename):
    # something's wrong with the zip file.  Maybe it's working with an app that uses
    # embed.jar instead, such as camino.  let's try that now.
    zipfilename = apppath + "/embed.jar"
    if not zipfile.is_zipfile(zipfilename):
        print "%s/toolkit.jar or %s/embed.jar is not the expected format." % (apppath, apppath)
        sys.exit(1)

# create backup file string
backup = "%s-backup-%s" % (zipfilename, time.strftime("%Y%m%d-%H%M%S"))
# make a backup with timestamp
shutil.copy2(zipfilename, backup)

# open the input file (the just-created backupfile)
readzip = zipfile.ZipFile(backup, mode='r')

# make sure the backup is not corrupt
if readzip.testzip():
    print "%s is corrupt." % (zipfilename)
    sys.exit(1)

# open the write file
writezip = zipfile.ZipFile(zipfilename, mode='w')

# process the toolkit.jar file
# the idea here is to read in the name of file in the jar(zip), see if it's the
# file we're looking for and, if not, directly output it to the new jar file.  If
# it is, then we'll process it, inserting the strings we want.  we'll edit its
# zipinfo file, adding the new timestamp, then output it to the new jar file too.
for filename in readzip.namelist():
    info = readzip.getinfo(filename)
    filestr = readzip.read(filename)
    if filename == "content/global/platformHTMLBindings.xml":
        # prepare the regex
        regex = re.compile(r'<binding id="(editor|textAreas|inputFields)">\s+<handlers>\s')
        # split the file in the appropriate places
        chunks = regex.split(filestr)
        # reassemble the file
        filestr = """%s<binding id="%s">
    <handlers>%s
%s<binding id="%s">
    <handlers>%s
%s<binding id="%s">
    <handlers>%s
%s""" % (chunks[0], chunks[1], bindings, chunks[2], chunks[3], bindings, chunks[4], chunks[5], bindings, chunks[6])
        # prepare the ZipInfo object
        info.date_time = time.localtime(time.time())[ :6]
    # add the file to the zip   
    writezip.writestr(info, filestr)

# close the zip file
writezip.close()

# make sure the new file is not corrupt
writezip = zipfile.ZipFile(zipfilename, mode='r')
if writezip.testzip():
    print "%s.new is corrupt." % (zipfilename)
else:
    print "%s.new is OK." % (zipfilename)

####### Repeat for thunderbird en-US.jar file

# create the string for en-US.jar
zipfilename = apppath + "/en-US.jar"

# make sure this is the correct type of file
if not zipfile.is_zipfile(zipfilename):
    print "%s/en-US.jar is not the expected format." % (apppath, apppath)
    sys.exit(1)

# create backup file string
backup = "%s-backup-%s" % (zipfilename, time.strftime("%Y%m%d-%H%M%S"))
# make a backup with timestamp
shutil.copy2(zipfilename, backup)

# open the input file (the just-created backupfile)
readzip = zipfile.ZipFile(backup, mode='r')

# make sure the backup is not corrupt
if readzip.testzip():
    print "%s is corrupt." % (zipfilename)
    sys.exit(1)

# open the write file
writezip = zipfile.ZipFile(zipfilename, mode='w')

# process the toolkit.jar file
# the idea here is to read in the name of file in the jar(zip), see if it's the
# file we're looking for and, if not, directly output it to the new jar file.  If
# it is, then we'll process it, inserting the strings we want.  we'll edit its
# zipinfo file, adding the new timestamp, then output it to the new jar file too.
for filename in readzip.namelist():
    info = readzip.getinfo(filename)
    filestr = readzip.read(filename)
    if filename == "locale/en-US/editor/editorOverlay.dtd":
      #
        filestr = re.sub( r'<!ENTITY stylebold.keybinding "b">',         r'<!ENTITY stylebold.keybinding "q">',         filestr)
        filestr = re.sub( r'<!ENTITY styleunderline.keybinding "u">',    r'<!ENTITY styleunderline.keybinding ")">',    filestr)
        filestr = re.sub( r'<!ENTITY editcheckspelling.keybinding "k">', r'<!ENTITY editcheckspelling.keybinding "(">', filestr)
       #filestr = re.sub( r'<!ENTITY stylestrikethru.accesskey "k">', r'', filestr)
     ##
     #  filestr = re.sub( r'<!ENTITY stylebold.accesskey "b">',       r'<!ENTITY stylebold.accesskey "B">',       filestr)
     #  filestr = re.sub( r'<!ENTITY stylebold.keybinding "b">',      r'<!ENTITY stylebold.keybinding "B">',      filestr)
     #  filestr = re.sub( r'<!ENTITY styleunderline.accesskey "u">',  r'<!ENTITY styleunderline.accesskey "U">',  filestr)
     #  filestr = re.sub( r'<!ENTITY styleunderline.keybinding "u">', r'<!ENTITY styleunderline.keybinding "U">', filestr)
     #  filestr = re.sub( r'<!ENTITY stylestrikethru.accesskey "k">', r'<!ENTITY stylestrikethru.accesskey "K">', filestr)
      #
       #filestr = re.sub( r'<!ENTITY stylebold.accesskey "b">',       r'<!ENTITY stylebold.accesskey "B">',       filestr)
       #filestr = re.sub( r'<!ENTITY styleunderline.accesskey "u">',  r'<!ENTITY styleunderline.accesskey "U">',  filestr)
       #filestr = re.sub( r'<!ENTITY stylestrikethru.accesskey "k">', r'<!ENTITY stylestrikethru.accesskey "K">', filestr)
      #
    #   filestr = re.sub( r'<!ENTITY stylebold.accesskey "b">',       r'', filestr)
    #   filestr = re.sub( r'<!ENTITY styleunderline.accesskey "u">',  r'', filestr)
    #   filestr = re.sub( r'<!ENTITY stylestrikethru.accesskey "k">', r'', filestr)
      #

      # filestr = re.sub( r'(<!ENTITY style)(bold|underline|strikethru)(.accesskey ")(.)">', r'\1\2\3\u\4">', filestr)
      # filestr = re.sub( r'ENTITY stylebold.accesskey "b">', r'ENTITY stylebold.accesskey "B">', filestr)
        # prepare the ZipInfo object
        info.date_time = time.localtime(time.time())[ :6]
    # add the file to the zip   
    writezip.writestr(info, filestr)

# close the zip file
writezip.close()

# make sure the new file is not corrupt
writezip = zipfile.ZipFile(zipfilename, mode='r')
if writezip.testzip():
    print "%s.new is corrupt." % (zipfilename)
else:
    print "%s.new is OK." % (zipfilename)



Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 5 guests