9

I don't need "Ubuntu-tweak" and i know about GUI method of associating certain files with certain applications using right click and "Open with". I am having problem setting filetype association globally in a file:

/usr/share/gnome/applications/defaults.list

E.g.:

image/x-psd=gimp.desktop

If i want to open all PSD's in a photoshop, i have created photoshop.desktop file and placed it under /usr/share/applications. Now when i press Super (windows) key and type Photoshop i see that icon, but i can't:

  1. drag'n'drop that on my desktop. How can i do that?
  2. if i change image/x-psd=gimp.desktop to image/x-psd=photoshop.desktop it still opens in a gimp. Why?

Thanks in advance.

1

3 Answers 3

13

Solved my issue myself.

File /etc/gnome/defaults.list are overriden by ~/.local/share/applications/mimeapps.list, so all file association goes in to mimeapps.list file:

[Default Applications]
image/vnd.adobe.photoshop=wine-extension-8bs.desktop

In this example I've set to open .psd in a Photoshop through Wine. If I go in to /etc/gnome/defaults.list and add:

image/vnd.adobe.photoshop=gimp.desktop

It won't open .psd in a Gimp, because it got overriden by mimeapps.list. Spent few hours to figure that out lol.

1
  • Very helpful, thank you. Do you have a link to the documentation about ~/.local/share/applications/mimeapps.list overriding /etc/gnome/defaults.list or where you found that information? Aug 11, 2016 at 5:09
2

Necromancing.
This is what worked for me:

added my desired application to /usr/share/applications.

sudo gedit /usr/share/applications/bash.desktop

Copy-paste over from Terminal (gnome-terminal.desktop), and replace gnome-terminal with 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

Now associate the application with shell-scripts.
To do so, edit mimeapps.list:

gedit ~/.local/share/applications/mimeapps.list 

Add the following lines at the end (after all entries in section [Default Applications]):

[Added Associations]
application/x-shellscript=bash.desktop

Now in "File Manager" (aka nautilus), browse to one of the files you want to open. Choose "Properties". In the "open with"-tab, choose reset.

And voilà, Shell scripts will now be opened by bash, if you double-click with the mouse.

0

You can append %U in the [Exec] field.

Ex:[Exec] = command %U

When you open a file with Open with, application list show that application. Once opened it will be saved as default application.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .