一、添加圖標:
圖標信息在以下兩處地方:
/usr/share/applications
~/.local/share/applications(用戶獨立配置存放地方,是個隱藏文件夾)
圖標信息文件以.desktop結尾,內容示例如下:
[Desktop Entry] Version=2.2.3 Name=Android Studio Exec=/home/Jim/android/android-studio/bin/studio.sh Terminal=false Icon=/home/JIm/android/android-studio/bin/studio.png Type=Application Categories=Development
配置項解釋如下:
- [Desktop Entry]打頭
- Version=1.0
- Name是該桌面項的名字,如果不指定, Launcher中的圖標會提示沒有名字
- GenericName是軟件的泛稱,比如:說明Sublime是一個文本編輯器,可以不寫
- Exec是執行的命令
- Icon是軟件的圖標
- Type=Application表明它是一個軟件應用
- Categories是軟件的分類
- 重點在x-Ayatana-Desktop-Shortchts=ooxx和[ooxx Shortcut Group],這里指定Launcher中按下右鍵出現的一些快捷方式,也就是菜單項啦,多個菜單的話這樣寫x-Ayatana-Desktop-Shortchts=a;b;c;d;,然后指定多個Group。
Chrome的.desktop文件寫法是個不錯的參考。
參考:http://ggicci.blog.163.com/blog/static/210364096201210219225273/
二、刪除無效的圖標方法:
查找目錄下的所有文件中是否含有某個字符串
find .|xargs grep -ri "圖標名"
查找目錄下的所有文件中是否含有某個字符串,並且只打印出文件名
find .|xargs grep -ri "圖標名" -l
在查找結果中刪除對應的文件即可。(可能重啟才生效)
參考:http://blog.csdn.net/zhongdajiajiao/article/details/51751269
三、使用第三方工具實現
https://askubuntu.com/questions/64222/how-can-i-create-launchers-on-my-desktop
https://developer.gnome.org/integration-guide/stable/desktop-files.html.en
https://askubuntu.com/questions/79583/adding-custom-applications-to-gnome-launcher