2016-04-21 15 views
3

我是新來的肉桂,我很失望,一些系統小程序不能很容易地修改它們的圖標。看到後,我從根目錄找到了「show-desktop」,並找到了/usr/share/cinnamon/applets/[email protected]目錄。在目錄中有兩個文件:applet.js和metadata.json。肉桂:修改「顯示桌面」(+其他系統小程序)圖標

metadata.json:

{ 
"uuid": "[email protected]", 
"name": "Show desktop", 
"description": "Minimize all windows", 
"icon": "menu", 
"max-instances": -1 
} 

「菜單」是不是很描述性的,所以我又撿起系統程序(垃圾),並看着它的圖標名「用戶垃圾」,並改變「菜單」到'用戶垃圾'

{ 
"uuid": "[email protected]", 
"name": "Show desktop", 
"description": "Minimize all windows", 
"icon": "user-trash", 
"max-instances": -1 
} 

這沒有任何影響,所以我看着applet.js。

this.set_applet_icon_name("user-desktop"); 
    this.set_applet_tooltip(_("Show desktop")); 

這些是重要的行,我再次看着垃圾小程序,並將其更改爲「用戶垃圾」。我在/ usr/share/icons/Adwaitia/32x32/places /文件夾中找到了圖標。

這給我留下了三個問題......

  1. 如何在applet知道該目錄的圖標看?是否有配置存儲在某處,或者是否存在另一個描述圖標及其位置的.js文件。

  2. 爲什麼修改.json文件對正在使用的圖標沒有影響,即使在重新加載肉桂後?

  3. 如何提供一個文件路徑到我自己的圖標來代替系統圖標,而不會將我的圖標放在該目錄中?

回答

0

的圖標設置爲您需要刪除的圖標的路徑,然後使用set_applet_icon_path()方法將試圖標更改爲自定義圖標的自定義圖標。您還必須確保刪除或註釋符號名稱方法。

// Assuming you have something similar to this for the applet_path: 
const UUID = "[email protected]"; 
const APPLET_PATH = imports.ui.appletManager.appletMeta[UUID].path; 

// in the MyApplet.prototype _init function. 

// Remove or comment out this line: 
//this.set_applet_icon_symbolic_name("icon-name"); 

// Add this in the MyApplet.prototype _init function. 
this.set_applet_icon_path(APPLET_PATH + "/icon.png") 
相關問題