🐧 Ubuntu .desktop 應用程式啟動筆記

🎯 目標

將自訂的 .sh 腳本包裝成 Ubuntu 桌面應用程式,並顯示在 Dock 上,達成 CLI 工具 GUI 化。


📁 檔案結構

/home/deltawen/
├── start_thunderbird.sh
└── .local/share/applications/start_thunderbird.desktop

/home/deltawen/iconpng/
└── thunderbird_logo.png

📝建立 .desktop 檔案內容

vi ~/.local/share/applications/start_thunderbird.desktop

內容

[Desktop Entry]
Name=start_thunderbird
Exec=/home/deltawen/start_thunderbird.sh
Icon=/home/deltawen/iconpng/thunderbird_logo.png
Terminal=false
Type=Application
Categories=Utility;

🔍 說明

欄位 功能說明
Name 顯示在 Dock 上的名稱
Exec 執行的腳本路徑
Icon 顯示圖示的路徑
Terminal 是否開啟終端機(此處為 false)
Type 類型為 Application
Categories 分類,可用於 GNOME 應用程式選單

🖥️ 建立.sh 腳本內容

vi ~/start_thunderbird.sh
#!/bin/sh
thunderbird

🔐 權限設定

chmod +x ~/start_thunderbird.sh
chmod +x ~/.local/share/applications/start_thunderbird.desktop

📌 Dock 顯示步驟

  1. 儲存 .desktop 檔案
  2. 在「應用程式選單」中搜尋 start_thunderbird
  3. 右鍵 → 加入最愛,即可固定在 Dock 上