Exec=cd PATH && <application-name> %F
did not work for me as PATH is not defined to point to the path of %F. The only variables available in any applications desktop file are:
- %f a single filename.
- %F multiple filenames.
- %u a single URL.
- %U multiple URLs.
- %d a single directory. Used in conjunction with %f to locate a file.
- %D multiple directories. Used in conjunction with %F to locate files.
- %n a single filename without a path.
- %N multiple filenames without paths.
- %k a URI or local filename of the location of the desktop file.
- %v the name of the Device entry.
There it is: %d is the single directory you're looking for, as it doesn't make sense to change to multiple directories. So go to /usr/share/applications and edit the file application-name.desktop (in your case pymol.desktop); you have to have superuser privileges to do that. Then locate the line that starts with "Exec=". It probably reads
(In your case Exec=pymol %F). Change this line to
Exec=cd %d && <application-name> %F
Save that desktop file, and next time you click on a .pdb file your working directory should be the one this .pdb file is in, so pymol can see all of your files there.
Of course, you could also start pymol from the command line after having first navigated to the directory where your files are, but I guess you wanted a GUI solution, so you have to do a little editing :-)