1

如果没有AutoHotkey 和 Firefox -unfocus,因为它涉及操作另一个程序并且它在 linux 上不起作用,并且没有Flash 插件后恢复窗口焦点,因为它不能让您控制 Flash 选项卡。

有没有人成功实现此gBrowser.selectedTab.unfocus();方法并将其绑定到 Firefox v3.6 中的击键?

我也试过(基于上面的插件)

if (document.getElementsByTagName("EMBED").length == 0) {
  return;
}

if (document.activeElement.tagName == "EMBED") {
      document.activeElement.blur();
}
return;

但它不起作用。

还尝试了绑定到按键的 JS 代码:

var file = Components.classes["@mozilla.org/file/local;1"].
  createInstance(Components.interfaces.nsILocalFile);
var process = Components.classes["@mozilla.org/process/util;1"].
  createInstance(Components.interfaces.nsIProcess);
var args = ["-unfocus"];
file.initWithPath("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
process.init(file);
process.run(false, args, args.length);

还是不行。

4

1 回答 1

1

Hi I am the author of unfocus extension.

Generally as far as I now you cannot simply bind keystroke in Firefox to unfocus plugin, because Firefox doesn't have focus. Plugin have full keyboard focus, so to unfocus plugin you must use external application. That's the reason for creating such extension. It's the only way with the most simple implementation.

I run linux and almost every Window Manager I know support keybindings to commands. AutoHotkey is only one of the ways to achieve this on Windows. Because of this I always seen this extension as far more simple for Linux/BSD crowd.

Bind a keystroke to firefox -unfocus command.

If you use metacity (default WM of gnome):

gconf-editor -> / -> apps -> metacity -> global_keybindings and keybinding_commands

If you use kwin (kde):

http://maketecheasier.com/configure-custom-shortcuts-in-kde/2009/09/28

novell.com/coolsolutions/qna/11619.html

If you use xfwm (xfce):

Keyboard Settings -> Shortcuts

If you use openbox (lxde):

http://urukrama.wordpress.com/openbox-guide/#Key_mouse

Note that I don't use previously mentioned WM-s and DE-s, I just searched a little. If you use tiling wm you should already know how to bind a keystroke.

于 2011-05-18T07:51:57.603 回答