3

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.

2
  • Did you install the windows version of Photoscape? Could you please post the URL of what you installed in particular? This is required for the command that will open your files with Photoscape. Basically you could either create a new file in ~/.local/share/applications and in there you associate the file types to be opened with Photoscape. The more obvious way would be to add associations via Linux Mint control center or file manager, see e.g. forums.linuxmint.com/viewtopic.php?f=190&t=130673 for that.
    – doktor5000
    Dec 31, 2014 at 12:28
  • I don't know how to get to ~/.local/share/applications or the Linux Mint control center. I am not experienced in Linux and I'm not the computer geek type. This is why I posted the question on this website. As for the URL it is oaultimate.com/computers/…. Photoscape does not have a Linux version. This is why I used the codes from this website to load it on my Mint 16 system.
    – Caveman
    Jan 1, 2015 at 5:31

2 Answers 2

1

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

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


EDIT:

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:

┌─[doktor5000@Mageia5]─[00:30:08]─[~] └──╼

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)

file manager context menu with open with including newly added PhotoScape association


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.

15
  • Well, it is true that anyone who never used Linux will not understand many of the functions or where everything is located. This should all be in the user guide. You can just tell me where things are located and then I will know. It is easier to use previously created scripts or codes to enter in the terminal for creating actions or loading software. I loaded Photoscape and Google Earth by getting the codes off of websites that gave simple directions using the terminal. If you give me the codes to enter in the terminal then I will try that and see what happens. Linux needs more than forums.
    – Caveman
    Jan 2, 2015 at 18:46
  • In addition to what I wrote above, I don't have issues with basic functions or finding anything if there is a way to learn this information. The guide does not explain many things in Linux operations and even the computer repair man I know has not learned any more than I have. To learn anything you need either a proper written guide for new users or someone to talk to who has the information and experience. Everyone learns faster by talking to someone who already knows the answer. Also, simple steps written out in blogs helps anyone to learn a new ability.
    – Caveman
    Jan 2, 2015 at 18:59
  • Well, you cannot put all the stuff around linux in the normal user guide of normal desktop distributions, that is just wishful thinking. Simply have a look at the sheer volume and size of e.g. tldp.org What I can recommend for reading is rute.2038bug.com/index.html.gz For a similar topic and related discussion, including more pointers to basic documentation around linux and computing please refer to forums.mageia.org/en/viewtopic.php?p=48481#p48481
    – doktor5000
    Jan 2, 2015 at 23:42
  • I followed your instructions and nothing happened. At one point it said command not found. That may be the problem. I went to usr/share/applications and Photoscape is not seen with the other applications. I have my desktop icon that opens the software and it is listed in the menu applications but that is it, other than downloads. I am using Linux Mint 16 Cinnamon, in case it makes a difference. Maybe I need to install something else for this to work. I tried your instructions twice but Photoscape was not added to the list. It should not be this complicated. Thanks for trying.
    – Caveman
    Jan 3, 2015 at 5:49
  • At which point did it say "command not found" ? No external commands are used here, but you have to be more verbose, otherwise people cannot help you properly via remote support. PhotoScape is not located in /usr/share/applications but in ~/.local/share/applications/wine/Programs/PhotoScape/ . Can you please show the output of ls -al ~/.local/share/applications/photoscape* The other thing would be to verify that drive Z: in wine is mapped to your / filesystem. Can you please open winecfg and check on the "drives" tab is drive Z: is mapped to /
    – doktor5000
    Jan 3, 2015 at 10:50
0

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

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.