1

I have recently moved to CentOS7 and thus GNOME3. In Astronomy, we work with FITS images. These images are not recognized and by default they are opened with Gimp (which is not what we want!). The most common program to open such images is SAO ds9, which is downloaded as an executable.

I can open images in the command line and there is no problem. In GNOME2.x, I would simply click "open with" and write the command to open FITS images with the ds9 -mecube command and there was no problem. But in GNOME 3, there is no such option. After some searching I thought that creating a .desktop file would be the best solution. So I made this desktop file in: /usr/share/applications/saods9.desktop

[Desktop Entry]
Type=Application
Name=SAO ds9
Encoding=UTF-8
Comment=Open ds9 as multiextension data cube
Exec=/usr/local/bin/ds9 -mecube %f
Terminal=false
Categories=Graphics;Science;

The SAO ds9 option was added to the programs list in the Open With menu, but when I click on it, nothing happens. It is also included under the Graphics applications in the "Applications" menu and when I click it there it opens, but it doesn't open a file when I click on it.

I wanted to know what I am not doing or doing wrong? thanks in advance.

makhlaghi
  • 3,856
  • 6
  • 27
  • 34

2 Answers2

3

I don't know exactly how to fix your issue.

However, I looked over the .desktop file that you provided and everything looked above board and I actually went ahead, downloaded ds9 and a sample .fits file from http://fits.gsfc.nasa.gov/fits_samples.html

I then created a new .desktop file almost identical to yours:

[Desktop Entry]
Type=Application
Name=SAO ds9 
Encoding=UTF-8
Comment=Open ds9 as multiextension data cube
Exec=/home/michael/Downloads/ds9 -mecube %f
Terminal=false
Categories=Graphics;Science;

and I stuck it in my .local/share/applications folder. Then I did what you described, went to the .fits file in Nautilus, right clicked, "Open With Other Application">"View All Applications", selected SAO ds9 and it opened right up with the file opened. I made sure that it was opening the file for sure instead of remembering the previous file or some such. Now when I right click on the .fits file, I am given the option to open it up with SAO ds9.

This is with Ubuntu Gnome 14.04 using Gnome 3.12.

This helps you a little in knowing that the syntax is correct and that the thought is on the right track. It might have to do with CentOS or with the version of Gnome that you have installed. You might try %u instead of %f, it worked on my setup as well.

Side Note: I know nothing about astronomy.

Mpstark
  • 31
  • 1
  • Note that the `.local/share/applications` folder is in my home directory with the absolute path `/home/michael/.local/share/applications`. Gnome will only load desktop files from there if I'm the user that is logged in. – Mpstark Aug 07 '14 at 03:50
  • Thanks a lot for taking the time to test it. I tried it with `%u` and it still doesn't work. I should also add that while I was searching, some people proposed to use `mimeopen -d` (which also didn't work). I tried that before trying the .desktop file. Do you think that has to do anything with the .desktop file not working? – makhlaghi Aug 07 '14 at 03:58
  • I actually don't know exactly how `mimeopen -d` works, since I've never had to use it much. You could try clearing out references to `ds9` by deleting the `.desktop` files (they may have gotten copied around; use `locate saods9.desktop`) and going through the `mimeinfo.cache` and `defaults.list` in `/usr/share/applications` for `ds9` references. Then you could start over with the method that worked on my computer. – Mpstark Aug 07 '14 at 04:18
  • Thanks again for the guidance. I found all the .desktop files that mimeopen had created (they were all in `.local/shared/applications/`, I tried more than once!) and removed them, but it still doesn't work. I guess I will contact the CentOS forums to see what they say. The fact that this .desktop file worked on your system is a great help. Thanks again. – makhlaghi Aug 07 '14 at 04:30
0

Thanks to Mpstark's post, I recognized that this is a CentOS (Redhat) issue and not general. So because of this and other problems, I was encouraged to get a better understanding of GNU/Linux so I moved to Arch Linux (with X.org 1.16 and GNOME 3.12). Where I could build the OS my self (and thus understand it), instead of ignorantly relying on what RedHat chooses to give me. Being so closer to the upstream developers, this issue did not exist there (as it didn't exist in Ubuntu): By simply putting the .desktop file in ~/.local/share/applications/, GNOME recognized the program and successfully opened the FITS image with SAO ds9.

makhlaghi
  • 3,856
  • 6
  • 27
  • 34