开发者

Conkeror Keybindings on Mac OSX

开发者 https://www.devze.com 2022-12-19 07:08 出处:网络
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开发者_C百科 my C mapped to the apple command key and my M mapped

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开发者_C百科 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号