問候語/登入畫面

問候語/登入畫面

Ubuntu 14.04 目前右上角有這些指示器:關機、鎖定按鈕、日曆時間詳細資料、電池詳細資料、輸入格式(英文)作為預設指示器。是否有可能使指標系統監視器作為這些預設指標之一。

現在發生的情況是,只有當我們登入電腦時,指示器-sysmonitor才會顯示,當您​​登出或鎖定我們的電腦時,指示器-sysmonitor將自動從面板退出。根據鎖定電腦的經驗,我知道指示器系統監視器在後台工作,但不會顯示在面板中。我有一些統計數據(包括 cpu、mem 和一些自訂),我想在鎖定電腦時查看它們。

可以嗎?

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 上的指標系統監視器(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 鎖定畫面上的指示器系統監視器

相關內容