為linux應用創建desktop入口
自己下載的軟件沒有desktop入口(也就是相當于windows的快捷方式),需要自己創建
1.創建.desktop文件
touch xxx.desktop //xxx換成你的應用名
vim xxx.desktop //用你喜歡的編輯器打開
2.編輯.desktop內容
可以先看一下其他軟件自帶的desktop,是怎么寫的。
以下是我的自己創建的:
[Desktop Entry]
Version=1.0
Type=Application
Name=TreeSheets
Comment=A hierarchical spreadsheet / outliner productivity tool.
Exec=/home/zzh/Apps/TreeSheets/treesheets %U
Terminal=false
Icon=/home/zzh/Apps/TreeSheets/share/icons/hicolor/scalable/apps/treesheets.svg
MimeType=application/x-treesheets;
Categories=Office;Utility;Spreadsheet;TextEditor;
Keywords=mindmaps;knowledge;organizer;organiser;information;brainstorming;pim;database;todo;
里面的參數可以精簡,可以簡化到這樣:
[Desktop Entry]
Type=Application
Name=TreeSheets
Comment=A hierarchical spreadsheet / outliner productivity tool.
Exec=/home/zzh/Apps/TreeSheets/treesheets %U
Terminal=false
Icon=/home/zzh/Apps/TreeSheets/share/icons/hicolor/scalable/apps/treesheets.svg
Categories=Office;Utility;Spreadsheet;TextEditor;
這幾個參數最主要,其中Exec和Icon,分別寫你相應的可執行文件和圖標的絕對路徑即可(帶文件名的路徑)
3.將desktop文件放入~/.local/share /applications
如果自己沒有修改設置,linux中desktop文件所在路徑為 /usr/share/applications或者~/.local/share/applications
參考
https://help.gnome.org/admin//system-admin-guide/2.32/menustructure-desktopentry.html.en | Desktop Entry Files
https://developer-old.gnome.org/integration-guide/stable/desktop-files.html.en | Desktop files: putting your application in the desktop menus

浙公網安備 33010602011771號