迎宾/登录屏幕

迎宾/登录屏幕

Ubuntu 14.04 目前右上角有这些指示器关机、锁定按钮、日历时间详细信息、电池详细信息、输入格式(英语)作为默认指示器。是否可以指标-系统监视器作为默认指标之一。

现在,只有当我们登录计算机时,指示器系统监视器才会显示,而当您注销或锁定计算机时,指示器系统监视器将自动退出面板。根据我在锁定计算机中的经验,指示器系统监视器在后台运行,但不会显示在面板中。我有一些统计数据(包括 CPU、内存和一些自定义数据),我想在锁定计算机时查看它们。

能做到吗?

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


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

答案1

迎宾/登录屏幕

我最终研究了它的nm-applet工作原理。我追踪了它,因为它似乎是硬编码的unity-greeter

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

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

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

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

    您可以Process.spawn_command_line_async ("nm-applet");在原始代码中找到nm-applet为欢迎界面生成的代码。复制一份完整的代码try..catch并进行修改,使其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 上的 indicator-sysmonitor(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
    

    尝试一下:CtrlAltL

    lightdm 锁定屏幕上的 indicator-sysmonitor

相关内容