English 中文(简体)
Conkeror Keybindings on Mac OSX
原标题:

Has anyone figured out how to change the keybindings for the meta and control keys for Conkeror on Mac OSX? For example, in Emacs I have my C mapped to the apple command key and my M mapped to the option key. Is there any way to do this for Conkeror? Can anyone supply the javascript for the .conkerorrc file?

问题回答

You ll have to fiddle a little with this to get it to be exactly what you want but as an example... rebinding C to M

modifiers.C = new modifier(
  function (event) { return event.metaKey; },
  function (event) { event.metaKey = true; });

All you ll need to do is replace C with M or A or S for Meta, Alt, and Super respectively. and then replace metaKey with what you want the key to be. I m not sure what the Command key produces so you ll have to fiddle with that but I m pretty sure that option is Alt so that would be

modifiers.M = new modifier(
  function (event) { return event.altKey; },
  function (event) { event.altKey = true; });

It s funny though, on every system but OS X, Conkeror treats Meta and Alt as the same by default.

Edit Actually it looks more complex than what I said at first. You should read the Conkeror wiki page about it.

Install KeyRemap4MacBook.

Put this in your .conkerorrc.

modifiers.C = new modifier(
  function (event) { return event.metaKey; },
  function (event) { event.metaKey = true; });
modifiers.M = new modifier(
  function (event) { return event.ctrlKey; },
  function (event) { event.ctrlKey = true; });

Put this in ~/Library/Application Support/KeyRemap4MacBook/private.xml.

<?xml version="1.0"?>
<root>
  <appdef>
    <appname>CONKEROR</appname>
    <equal>org.mozdev.conkeror</equal>
  </appdef>
  <item>
    <name>Enable only in Conkeror</name>
    <item>
      <name>Option_L to Control_L</name>
      <identifier>private.app_cokeror_option_l_to_control_l</identifier>
      <only>CONKEROR</only>
      <autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::CONTROL_L</autogen>
    </item>
    <item>
      <name>Option_R to Control_R</name>
      <identifier>private.app_conkeror_option_r_to_control_r</identifier>
      <only>CONKEROR</only>
      <autogen>__KeyToKey__ KeyCode::OPTION_R, KeyCode::CONTROL_R</autogen>
    </item>
  </item>
</root>

Launch KeyRemap4MacBook and check the two boxes under "Enable only in Conkeror".

You should find cmd is M- and alt is C-.

Making cmd into M- was straighforward - it s the first three lines of .conkerorrc. Making alt into C- is not straightforward because Conkeror is not able to detect when the alt key is pressed in OS X. That is why I told Conkeror to listen for ctrl key presses, then installed KeyRemap4MacBook to pretend the alt keys are actually ctrl keys, but only for Conkeror. Natually, this means both ctrl and alt are M-. This shouldn t be a problem unless you really want to put your ctrl keys to another use.





相关问题
2 mysql instances in MAC

i recently switched to mac. first and foremost i installed xampp. then for django-python-mysql connectivity, i "somehow" ended up installing a seperate MySQL. now the seperate mysql installation is ...

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Controlling OSX windows

I m trying to control windows of a foreign OSX applications from my application. I d like to 1. move the windows on the screen 2. resize the windows on the screen 3. change the currently active window ...

Switching J2SE versions on Mac OS (SnowLeopard)

My current JDK on Mac OS (10.6) is set to 1.6 and I d like to switch to 1.5. A listing of /System/Library/Frameworks/JavaVM.framework/Versions/ shows: lrwxr-xr-x 1 root wheel 10 Nov 3 18:34 ...

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

export to MP3 from quicktime API

A question for Apple,QT programmers. Would like to know if it s possible to export a Movie object to MP3 using the QuickTime API. Preferably the ConvertMovieToFile function. I ve looked at ...

热门标签