Thursday, May 15, 2008

Can Firefox keyconfig fix Home/End buttons in textboxes?

In poking around a little further with the problem of creating custom key mappings in Firefox for Mac, I found the plugin named keyconfig (see forum discussion). The plugin seems reasonable on the surface, but it's not actively supported, and its web presence is poor. The best article I found was here on random($foo). Unfortunately, the shortcuts it includes seem to be just for navigating, and not for text edit boxes. I suspect it's possible to add custom code to make keyconfig do what Starry Hope's Firefox keyfixer does -- remap the home/end keys to go to the beginning/end of the current line -- but I couldn't find out how without a lot of poking around.

Keyfixer is a patch utility that modifies the Firefox configuration file named platformHTMLbindings.xml (kept inside the zip file named /Applications/Firefox.app/Contents/MacOS/chrome/toolkit.jar) with the appropriate key board shortcuts. For example, these are the lines that change Home/End to go to the beginning/end of the current line instead of top/bottom of current edit window.

<!-- Additions to fix home/end -->
<handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine"/>
<handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine"/>

The question I have is whether similar changes are possible within the keyconfig firefox plugin. If this is possible, it would be much easier to maintain because you have to uninstall Firefox keyfixer before upgrading firefox.

I see a lot of potential in keyconfig because it's a firefox plugin, and is something that should be in Firefox anyways, but right now I can't make it work better than the keyfixer patch.

3 comments:

  1. Yes, using "keyconfig" is easy: just disable the existing mappings for Cmd-Left and Cmd-Right. See also http://www.macosxhints.com/article.php?story=20070511123925218

    ReplyDelete
  2. That works for some text editors, but for some reason it still doesn't enable the Home/End functionality in the Gmail editor, which is maddening. Does anyone know how to properly write the code above to work as custom keys in Keyconfig?

    ReplyDelete
  3. Thanks to the commands here, and examples somewhere else I figured out the code to use in keyconfig to make the home and end keys in Mac OSX/Firefox work like in windows (begin/end of line):

    goDoCommand("cmd_beginLine")
    goDoCommand("cmd_endLine")

    That's all. One less annoyance for me!

    ReplyDelete

Note: Only a member of this blog may post a comment.