I want to add a software to the "open with" other applications list that drops down after clicking on a photo to open. I installed Photoscape on my Linux Mint 16 system but it does not show in the list of choices to open a photo. i want to make it my default viewer for photos. At the bottom under other applications it says you can add a custom command to add a software to the list and also make it your default viewer. I have no idea how to do this or where many things are located in Linux Mint 16. I am new to Linux and don't know all the Linux tech talk or codes. So, things like creating shells, custom commands or other actions not needed in Windows is foreign to me. I am not a computer geek.
OK, I tried it with PhotoScape locally and the file association is working, e.g. "Open with" context menu from file manager offers PhotoScape for .jpg files.
What you basically need to do is explained in Configuring File Associations in Ubuntu with Wine and partly in http://blog.thewebsitepeople.org/2010/12/nautilus-open-with-mime-type-associations/
You need to create two files
- one script that will convert the path to the file you want to open with PhotoScape so that wine can access it
- one .desktop file that associates the mime types (e.g. jpg, .png, .bmp or whatever you need) with the abovementioned script
~/.local/share/applications/photoscape.sh looks like this here:
#!/bin/sh param= while [ "$1" ] do param="$param Z:$1" shift done wine "C:\Program Files\PhotoScape\PhotoScape.exe" $param
What it does is to add Z: (that is the drive letter where wine will see the rest of your linux system's directory structure on most distributions) to the path of the image that you want to open with PhotoScape.
The .desktop file
~/.local/share/applications/photoscape.desktop which in my example associates .jpg files with the abovementioned script looks like this:
[Desktop Entry] Version=1.0 Type=Application Terminal=false Name=PhotoScape Exec=~/.local/share/applications/photoscape.sh Path=/home/doktor5000/.wine/dosdevices/c:/Program Files/PhotoScape Icon=8FC0_PhotoScape.0 MimeType=image/jpeg;
Create both files, important part is that the .desktop file is located either in ~/.local/share/applications or in /usr/share/applications if you want to enable the association with PhotoScape for all users.
After creating those two files, close your file manager, reopen it and right-click on a .jpg file, and it should offer to open it with PhotoScape.
As the OP has asked for easy way to create those files via terminal commands, what follows is a complete session to create both files. All commands should be run as a normal user NOT as root as that is not necessary at all. My prompt is also included in the output and looks like this:
the files do not exist
┌─[doktor5000@Mageia5]─[00:34:14]─[~] └──╼ ls -al ~/.local/share/applications/photoscape* ls: cannot access /home/doktor5000/.local/share/applications/photoscape*: No such file or directory
creating the containing folder in case it does not exist
┌─[doktor5000@Mageia5]─[00:34:15]─[~] └──╼ mkdir -p ~/.local/share/applications
creating the first file via a so-called here document
┌─[doktor5000@Mageia5]─[00:51:42]─[~] └──╼ cat << 'EOF' > ~/.local/share/applications/photoscape.sh > #!/bin/sh > param= > while [ "$1" ] > do > param="$param Z:$1" > shift > done > wine "C:\Program Files\PhotoScape\PhotoScape.exe" $param > EOF ┌─[doktor5000@Mageia5]─[00:52:07]─[~] └──╼
Hint: The command you run is
cat << 'EOF' > ~/.local/share/applications/photoscape.sh and when you press enter, the cursor will jump to the next line and display the
> character instead of your normal prompt. Then insert the content of the file as I have posted it above, without the
> characters, those will be added by your shell automatically. On the last line, you need to enter
EOF ( short for end of file ) and press return key, and the here document will be written to the file ~/.local/share/applications/photoscape.sh and your normal prompt will return.
adding executable permission to the script and checking the result
┌─[doktor5000@Mageia5]─[00:52:07]─[~] └──╼ chmod +x ~/.local/share/applications/photoscape.sh ┌─[doktor5000@Mageia5]─[00:56:23]─[~] └──╼ ls -al ~/.local/share/applications/photoscape.sh -rwxr-xr-x 1 doktor5000 doktor5000 123 Jan 3 00:52 /home/doktor5000/.local/share/applications/photoscape.sh* ┌─[doktor5000@Mageia5]─[00:56:28]─[~] └──╼ cat /home/doktor5000/.local/share/applications/photoscape.sh #!/bin/sh param= while [ "$1" ] do param="$param Z:$1" shift done wine "C:\Program Files\PhotoScape\PhotoScape.exe" $param ┌─[doktor5000@Mageia5]─[00:57:07]─[~] └──╼
adding the .desktop file, same as before
┌─[doktor5000@Mageia5]─[00:57:07]─[~] └──╼ cat << EOF > ~/.local/share/applications/photoscape.desktop > [Desktop Entry] > Version=1.0 > Type=Application > Terminal=false > Name=PhotoScape > Exec=~/.local/share/applications/photoscape.sh > Path=/home/doktor5000/.wine/dosdevices/c:/Program Files/PhotoScape > Icon=8FC0_PhotoScape.0 > MimeType=image/jpeg; > EOF ┌─[doktor5000@Mageia5]─[01:07:40]─[~] └──╼
make it executable to make it a "trusted" desktop file and checking the result:
┌─[doktor5000@Mageia5]─[01:11:01]─[~] └──╼ chmod +x ~/.local/share/applications/photoscape.desktop ┌─[doktor5000@Mageia5]─[01:11:10]─[~] └──╼ ls -al ~/.local/share/applications/photoscape.desktop -rwxr-xr-x 1 doktor5000 doktor5000 234 Jan 3 01:07 /home/doktor5000/.local/share/applications/photoscape.desktop* ┌─[doktor5000@Mageia5]─[01:11:55]─[~] └──╼
Now finally if you open your file manager, and right-click on any .jpg file, PhotoScape should appear in the "Open with" context menu. It looks like this here (your filemanager is probably nautilus and it will look differently in general but hope you get the idea)
Apart from that, the problem seems to me that you have issues with basic actions like finding the Mint control center, hence my proposal would be to either find a local IT shop that can help you with this on your system. Or the second option would be to open a thread in Linux Mint support forum so that they can guide you through this.
From my personal experience with similar topics it is really hard to guide novices through such complex procedures. I could even provide you with terminal commands to create those two files or via a text editor of your choice, but as you seem to struggle with this, it may be quite a long way to get to the point where it works for you.
In any case, feel free to ask.
A solution is to look for the *.desktop file for that particular program (for example, photoshop.desktop) and add % F at the end of the line starting with Exec
I did this process for stata14. In my Ubuntu 15.01 machine I found the file in the following folder
cd /usr/share/applications/ sudo vim stata14.desktop
The file initially was like this:
1 [Desktop Entry] 2 Version= 14.1 3 Terminal=false 4 Icon=/usr/share/icons/stata14.png 5 Type=Application 6 Categories=Education;Scientific; 7 Exec=/usr/local/stata14/xstata-mp 8 MimeType=application/x-stata-dta;application/x-stata-do; 9 Name=Stata/MP 14 10 Comment=Perform statistical analyses using Stata.
I modified only the 7th line and added %F at the end:
7 Exec=/usr/local/stata14/xstata-mp %F