Thursday, September 15, 2011

gnome shell hijack to show ibus(顶栏显示ibus状态)

~/gnomeshellibus.html
 1 现在使用gnomeshell因为ibus状态栏在底部通知栏,使用vim,gvim还有firefox的pentadactly扩展
 2 的时候老看不到输入法状态,导致很多快捷键无法运行,很是恼火。
 3 
 4 
 5 近日看了看gnome-shell的通知区域的设计,发现gnomeshell本意是把ibus放在顶面板的,由于和ibus
 6 输入法的沟通没有做好,导致通知区域的的ibus名称不正确,所以,我们的ibus也就毫无办法的到了
 7 底部通知栏...
 8 
 9 察看原码
10 
11 statusIconDispatcher.js文件在/usr/share/gnome-shell/js/ui目录下
12 
13 
14 
15 const STANDARD_TRAY_ICON_IMPLEMENTATIONS = {
16     'bluetooth-applet': 'bluetooth',
17     'gnome-volume-control-applet': 'volume', // renamed to gnome-sound-applet
18                                              // when moved to control center
19     'gnome-sound-applet': 'volume',
20     'nm-applet': 'network',
21     'gnome-power-manager': 'battery',
22     'keyboard': 'keyboard',
23     'a11y-keyboard': 'a11y',
24     'kbd-scrolllock': 'keyboard',
25     'kbd-numlock': 'keyboard',
26     'kbd-capslock': 'keyboard',
27     'ibus-ui-gtk': 'input-method'//看到没有ibus-ui-gtk多少年前的东西了..
28 };
29 
30 一个简单的小hack只要把'ibus-ui-gtk'改为'main.py'就可以了
31 
32 const STANDARD_TRAY_ICON_IMPLEMENTATIONS = {
33     'bluetooth-applet': 'bluetooth',
34     'gnome-volume-control-applet': 'volume', // renamed to gnome-sound-applet
35                                              // when moved to control center
36     'gnome-sound-applet': 'volume',
37     'nm-applet': 'network',
38     'gnome-power-manager': 'battery',
39     'keyboard': 'keyboard',
40     'a11y-keyboard': 'a11y',
41     'kbd-scrolllock': 'keyboard',
42     'kbd-numlock': 'keyboard',
43     'kbd-capslock': 'keyboard',
44     'main.py': 'input-method'//就是这里,改了就ok了..
45 };
46 
47 写成脚本就是下面的了:
48 ibus extensions
49 
50 1   StatusIconDispatcher = imports.ui.statusIconDispatcher;
51 2
52 3   function main() {
53 4       StatusIconDispatcher.STANDARD_TRAY_ICON_IMPLEMENTATIONS['main.py'] = 'ibus';
54 5   }

No comments: