我不需要“Ubuntu-tweak”,我知道使用右鍵單擊和“開啟方式”將某些文件與某些應用程式關聯的 GUI 方法。我在文件中全域設定文件類型關聯時遇到問題:
/usr/share/gnome/applications/defaults.list
例如:
image/x-psd=gimp.desktop
如果我想在 Photoshop 中開啟所有 PSD,我已經建立了 photoshop.desktop 檔案並將其放在/usr/share/applications
.現在,當我按下 Super(Windows)鍵並輸入 Photoshop 時,我會看到該圖標,但我看不到:
- 將其拖放到我的桌面上。我怎樣才能做到這一點?
- 如果我更改
image/x-psd=gimp.desktop
為image/x-psd=photoshop.desktop
它仍然會打開。為什麼?
提前致謝。
答案1
我自己解決了我的問題。
文件/etc/gnome/defaults.list
被 覆蓋~/.local/share/applications/mimeapps.list
,因此所有文件關聯都進入mimeapps.list
文件:
[Default Applications]
image/vnd.adobe.photoshop=wine-extension-8bs.desktop
在此範例中,我設定為.psd
透過 Wine 在 Photoshop 中開啟。如果我進入/etc/gnome/defaults.list
並添加:
image/vnd.adobe.photoshop=gimp.desktop
它不會.psd
在 Gimp 中打開,因為它被mimeapps.list
.花了幾個小時才弄清楚,哈哈。
答案2
死靈術。
這對我有用:
將我想要的應用程式新增至/usr/share/applications。
sudo gedit /usr/share/applications/bash.desktop
從終端機 (gnome-terminal.desktop) 複製貼上,並將 gnome-terminal 替換為 bash:
[Desktop Entry]
Name=Bash
Comment=Use the command line
Keywords=shell;prompt;command;commandline;cmd;bash;
TryExec=bash
Exec=bash
Icon=utilities-terminal
Type=Application
X-GNOME-DocPath=gnome-terminal/index.html
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=bash
X-GNOME-Bugzilla-Component=BugBuddyBugs
X-GNOME-Bugzilla-Version=3.18.3
Categories=GNOME;GTK;System;TerminalEmulator;
StartupNotify=true
X-GNOME-SingleWindow=false
OnlyShowIn=GNOME;Unity;
Actions=New
X-Ubuntu-Gettext-Domain=bash
[Desktop Action New]
Name=New Shell
Exec=bash
OnlyShowIn=Unity
現在將應用程式與 shell 腳本關聯起來。
為此,請編輯 mimeapps.list:
gedit ~/.local/share/applications/mimeapps.list
在末尾添加以下行(在 [預設應用程式] 部分中的所有條目之後):
[Added Associations]
application/x-shellscript=bash.desktop
現在,在「檔案總管」(又稱 nautilus)中,瀏覽到您要開啟的檔案之一。選擇“屬性”。在「開啟方式」標籤中,選擇重置。
瞧,如果您雙擊滑鼠,Shell 腳本現在將由 bash 開啟。
答案3
您可以在欄位%U
中追加[Exec]
。
前任:[Exec] = command %U
當您使用以下命令開啟檔案時打開用,應用程式清單顯示該應用程式。打開後,它將被保存為預設應用程式。