Making the Home/End keys work on Mac like they do on Windows/Linux
Mac Home/End keys (and page-up/page-down, though that's less relevant to Firefox) are profoundly useless as designed. I want the same behavior as you get from Windows/Linux: Home means start-of-line, End means end-of-line.
This tool used to work:
http://www.starryhope.com/keyfixer-firefox-version/
...but he says not to use it on recent versions of Firefox. Just writing this question I've already tried to use home and end three or four times; it's terribly frustrating.
Why not just make the key bindings work in a sane way by default? And if that's a problem, then please give us some option to switch it. I've already changed the GLOBAL key bindings for Mac so that home and end work as expected; it would MINIMALLY be expected that Firefox would respect the global system settings. Firefox is currently the only program I'm using that doesn't respect those settings. Failing that, please provide a hack that will make Firefox behave in a sane manner.
All I can find are suggestions that people not use Carat browsing. It's amazing how many people asked that same question.
所有回复 (6)
Hi SomeCallMeTim,
Have you looked into any of the amazing add-ons available for Firefox? Customizable Shortcuts would probably do what you are looking for.
You could also check out this thread from Mozillazine:
http://forums.mozillazine.org/viewtopic.php?t=72994
Hopefully this helps!
Someone else asked about this recently and I wasn't able to come up with a good answer in that thread: How do I move curser to end of line on Mac (cmd+arrow key doesn't work) | Firefox Support Forum | Firefox Help.
Does making a change at the system level help? This article is from 2007, so I don't know whether it applies to your version of MacOS: Mac Switchers Tip: Remap the Home and End keys.
Edit: This post says that last trick doesn't work in Firefox: PC-like key bindings on a Mac.
由jscher2000 - Support Volunteer于
I went groping around in the Firefox source code and here is the difference:
Windows (\content\xbl\builtin\win\platformHTMLBindings.xml):
<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"/>
MacOS (\content\xbl\builtin\mac\platformHTMLBindings.xml):
<handler event="keypress" keycode="VK_LEFT" modifiers="accel" command="cmd_beginLine"/> <handler event="keypress" keycode="VK_RIGHT" modifiers="accel" command="cmd_endLine"/> <handler event="keypress" keycode="VK_LEFT" modifiers="accel,shift" command="cmd_selectBeginLine"/> <handler event="keypress" keycode="VK_RIGHT" modifiers="accel,shift" command="cmd_selectEndLine"/> <handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/> <handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
Let's set aside the possibility of recompiling Firefox. Who has time for that? Instead... does Cmd+Left or Ctrl+A actually work? If so, perhaps we could overlay an event handler that recognizes the home key and converts it to Cmd+Left or Ctrl+A (i.e., dispatches a new keyboard event synthesized in code and cancels the default behavior of the Home key, if any).
@jscher2000 Thanks for the info. I actually found a link after some more digging that involved just unpacking and repacking the Firefox code. The article is, unfortunately, outdated, but a little sleuthing turned up a file in the Firefox package at this location:
Firefox.app/Contents/MacOS/omni.ja
It's also a zip-style file, and can be extracted -- so I did. And lo and behold, inside that file I found the .xml file that you found, and that the above linked article referenced, at this path:
chrome/toolkit/content/global/platformHTMLBindings.xml
I swapped in the one referenced in the article for the one in Firefox, backed up the previous omni.ja file, re-zipped the new omni.ja, and then re-ran Firefox. Bingo.
Thanks for digging around for me. Sorry I didn't get around to following up on this with my result until now; it's been a crazy day.
A real fix for this should be a setting at the app level to enable standard home/end behavior. It's not like it would be hard to have a few extra settings that could optionally override the defaults. At a minimum an add-on to do this would be good, but none of the ones I could find did the job.
Hope this helps someone else who's looking for this answer.
由SomeCallMeTim于
A real fix for this should be a setting at the app level to enable standard home/end behavior.
It's very Windows-centric of us to think that way. ;-)
A UI for keyboard configuration has always been a wish list item in Firefox. Maybe it will finally be implemented some day if a developer takes an interest.
It's very Windows-centric of us to think that way
I would actually consider full keyboard reprogramming to be more Windows-like. The hallmark of Mac UI design is to not add all that complexity (though I know at least some apps include the ability to remap shortcuts to features). It's not like it's easy to tweak the Mac to use those keys correctly either; oddly enough it's something that's easier to do in Windows or Linux than on the Mac.
The Mac was never designed to be keyboard-driven; that was bolted on after the fact, and it shows. Did you know the first Macs shipped with no arrow keys at all? Much less home/end/page-up/page-down. You had to use the mouse for any navigation through a document. There is still no way to navigate menus from the keyboard on the Mac. And if a Mac app ends up off-screen by mistake, because you've disconnected your external monitor? Good luck getting it back using the keyboard. On Windows it's a few key-presses and a drag of the mouse, and it's back.
But I'm doing iOS development, so I need to work on a Mac from time to time, so what can I do? Most of my work on Windows and/or Linux, with only the occasional Mac adventure. At least I can try.
Thanks again. :)