文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>使用你喜欢的快捷键

使用你喜欢的快捷键

时间:2009-08-06  来源:wyg1258

Google 的 Glen Murphy 写了 WinXP 下的 Chrome 的一个 hack,使用 CapsLock 来新建标签。这里给出 Linux 下的替代方法,而且可以推广到其它程序。

我使用的管理器是 Sawfish。利用 Sawfish 中的函数 synthesize-event 和系统程序 xmodmap 可以如下实现:

将下列代码加入 .xmodmap

 remove Lock = Caps_Lock keycode 66 = XF86New  

再在 Sawfish 中定义函数 send-event-to-window-if-match

 (defun send-event-to-window-if-match (class-regexp event else-event) (lambda (w) (interactive "%W") (if (string-match (window-class w) class-regexp) (synthesize-event event (input-focus)) (synthesize-event else-event (input-focus)))))  

和函数 rebind-key

 (defun rebind-key (class-regexp orig-event sim-event #!optional replacement) (bind-keys window-keymap orig-event (send-event-to-window-if-match class-regexp sim-event orig-event)) (if replacement (bind-keys window-keymap replacement (send-event-to-window-if-match class-regexp orig-event replacement))))  

现在,我希望用 XF86New,也就是 CapsLock,来新建标签,只需重新绑定键:

 (rebind-key "^Chrome$" "XF86New" "C-t")  

如果我想在 Chrome 中用不常用的键“`”来关闭标签,并用“Ctrl-`”输入字符“`”,只需绑定:

 (rebind-key "^Chrome$" "`" "C-w" "C-`")  

同理可以应用到其他程序中。

相关阅读 更多 +
排行榜 更多 +
动物大战僵尸I

动物大战僵尸I

飞行射击 下载
龙兽争霸无限零件图纸

龙兽争霸无限零件图纸

飞行射击 下载
金属战士2最新版

金属战士2最新版

飞行射击 下载