7

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
11

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 '16 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:

sudo 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.