如何将indicator-sysmonitor设置为登录屏幕上的默认指示器

Ubuntu 14.04目前在右上角有这些指示灯关机,锁定按钮,日历时间细节,电池详情,输入格式(英文)作为默认指标。 是否可以将指标-sysmonitor作为其中一个默认指标。

现在发生的事情是,只有当我们登录到计算机时,才会显示指示符 – sysmonitor,当您注销或锁定我们的计算机指示器时,sysmonitor将自动退出面板。 我知道从锁定计算机指示器 – sysmonitor的经验在后台工作,但不会在面板中显示。 我有一些统计数据(包括cpu,mem和一些自定义),当我锁定我的电脑时,我想看到它。

能做到吗?

PS我在主软件网站上问了这个问题,作者推荐了这个网站。


我看过这个问题及其答案,看起来很有希望 – 但我不知道如何调整指标-sysmonitor的答案。

Greeter /登录屏幕

我最终看看nm-applet是如何工作的。 我追踪它,因为它看起来很难在unity-greeter

此修改使其在引导或注销后出现在问候屏幕中(但不在锁定屏幕中)。

  1. 下载源代码并构建依赖项

     sudo apt-get build-dep unity-greeter apt-get source unity-greeter 
  2. indicator-sysmonitor添加spawn函数

     cd unity-greeter-*/ vim src/unity-greeter.vala +590 

    在那里你找到Process.spawn_command_line_async ("nm-applet"); 在原始代码中为greeter屏幕生成nm-applet 。 使用完整的try..catch包装制作它的副本,并将其修改为spawn indicator-sysmonitor

      /* Make nm-applet hide items the user does not have permissions to interact with */ Environment.set_variable ("NM_APPLET_HIDE_POLICY_ITEMS", "1", true); try { Process.spawn_command_line_async ("nm-applet"); } catch (Error e) { warning ("Error starting nm-applet: %s", e.message); } /* I added these for sysmonitor, from here */ try { Process.spawn_command_line_async ("indicator-sysmonitor"); } catch (Error e) { warning ("Error starting indicator-sysmonitor: %s", e.message); } /* to here */ } 
  3. 建立

     ./autogen.sh ./configure --prefix=/usr make -j2 
  4. 安装

     sudo cp src/unity-greeter /usr/local/sbin/unity-greeter 
  5. 重启

    unity-greeter上的指示符 - 系统监视器(Ubuntu问候屏幕)


锁屏

无论如何,这将显示所有应用程序指标(请注意屏幕截图中的nm-applet),这可能是安全和隐私的缺陷。 可以仅为锁屏模式预定义指标列表,我没有时间这样做并进行测试。

  1. 下载源代码并构建依赖项

     sudo apt-get build-dep unity apt-get source unity 
  2. 修改unity-panel-service以加载应用程序指示器,即使在锁屏模式下也是如此。

     cd unity-7*/ vim services/panel-service.c +893 

    if (!lockscreen_mode)阻止在锁定屏幕模式下加载指示器。

     static void initial_load_default_or_custom_indicators (PanelService *self, GList *indicators) { GList *l; suppress_signals = TRUE; if (!indicators) { /* comment these lines if (!lockscreen_mode) { load_indicators (self); } */ // add this line load_indicators (self); load_indicators_from_indicator_files (self); sort_indicators (self); } ... 
  3. 建立

     mkdir build cd build/ cmake ../ make 
  4. 安装

     sudo mv /usr/lib/unity/unity-panel-service /usr/lib/unity/unity-panel-service.orig sudo cp services/unity-panel-service /usr/lib/unity/unity-panel-service 

    试一试: Ctrl Alt L.

    lightdm锁屏上的指示器 - 系统监视器