[Solved] Setting a .desktop file in GNOME3

Issues related to applications and software problems
Post Reply
makhlaghi
Posts: 6
Joined: 2014/08/07 04:33:59

[Solved] Setting a .desktop file in GNOME3

Post by makhlaghi » 2014/08/07 04:41:17

I have recently moved to CentOS7 and thus GNOME3. In Astronomy, we work with [FITS images][http://en.wikipedia.org/wiki/FITS]. 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][http://ds9.si.edu/site/Home.html], 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

Code: Select all

[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 was not familiar with this forum and so I asked this question first in [StackOverflow][http://stackoverflow.com/questions/2517 ... -in-gnome3]. A user there tried this same desktop file on Ubuntu and it worked.

I wanted to know what I am not doing or doing wrong? thanks in advance.
Last edited by makhlaghi on 2014/09/13 01:28:14, edited 1 time in total.

larryg
Posts: 5
Joined: 2014/07/17 04:48:28

Re: Setting a .desktop file in GNOME3

Post by larryg » 2014/08/08 03:30:24

Take you custom .desktop file and put it in the Desktop directory under your home account (/home/username/Desktop). Make sure it has executable permission (chmod 755). It will then automatically appear on your desktop.

If you want to easily add a launcher to your Applications Menu the best way I've found is using the alacarte tool. Check your Application Menu, look in the Sundry sub-menu and check for an entry 'Main Menu'. If it's not there you'll need to install alacarte. The following blog post has some good info on doing this

http://blog.randell.ph/2011/08/01/how-t ... n-gnome-3/

or just google 'Gnome 3 alacarte' and there's plenty of links explaining the tool.

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: Setting a .desktop file in GNOME3

Post by lightman47 » 2014/08/08 12:24:47

(From Fedora 20 - may be similar): Right-click on file's name and select "Properties". Select the "Open with" tab to change default, then "Set as default"

I don't have CentOS 7; not sure if I will, at least not soon - just got all my CentOS 6 machines set up. :)

larryg
Posts: 5
Joined: 2014/07/17 04:48:28

Re: Setting a .desktop file in GNOME3

Post by larryg » 2014/08/08 16:18:37

The procedure for adding a file association to CentOS 7 is covered in the Red Hat Enterprise 7 Desktop Migration and Administration Guide. You can download a copy at

https://access.redhat.com/documentation ... -en-US.pdf

Check out the procedure start at page 52.

makhlaghi
Posts: 6
Joined: 2014/08/07 04:33:59

Re: Setting a .desktop file in GNOME3

Post by makhlaghi » 2014/09/06 05:03:07

Thank you very much for your replies. I am sorry for this late reply, I was not notified of your answers.

The problem is not a launcher, it is that I want to be able to double-click on a FITS file and I wand CentOS to recognize that it should open it with SAO ds9. I have a launcher in my applications menu and when I want to open it, it opens the application fine. But when I double click on a FITS file, nothing happens. I have also set SAO ds9 to be the default program for this file type, but still it doesn't work.

I applied all the steps in page 52 of the RedHat Enterprise 7 Desktop migration and administration guide, but nothing changed. The problem remains.

I would be very grateful if someone could guide me on fixing this very troubling issue.

makhlaghi
Posts: 6
Joined: 2014/08/07 04:33:59

Re: Setting a .desktop file in GNOME3

Post by makhlaghi » 2014/09/06 14:27:18

I would like to add that as a test I replaced

Code: Select all

Exec=/usr/local/bin/ds9 -mecube %f
with

Code: Select all

Exec=gimp %f
And gimp opens when I double click on the file!!!!! I am really confused. ds9 opens perfectly on the commandline, this .desktop file also works nicely when I select it in the activities menu, but when I click on it, nothing happens.

makhlaghi
Posts: 6
Joined: 2014/08/07 04:33:59

Re: Setting a .desktop file in GNOME3

Post by makhlaghi » 2014/09/07 01:44:51

I am happy to say that I think I fixed the problem (at least for the time being), although my confusion remains:

Last night, I shrank the ".desktop" file to its bare essentials:

Code: Select all

[Desktop Entry]
Type=Application
Name=SAO ds9
Exec=ds9 -mecube %f
But after I saved the file, the result didn't work, so after some trials I gave up and went to sleep. This morning, when I turned the computer on, this new ".desktop" file opened the fits file when I double-clicked on it. I restarted the computer and it still works. So it seems to be working, but I don't understand why it didn't work last night!?!

makhlaghi
Posts: 6
Joined: 2014/08/07 04:33:59

Re: Setting a .desktop file in GNOME3

Post by makhlaghi » 2014/09/07 02:13:26

I done some of my work (Without changing any settings related to this issue) and after a log out and log back in, the file didn't open again by double clicking (nothing happens) :shock: !

makhlaghi
Posts: 6
Joined: 2014/08/07 04:33:59

Re: Setting a .desktop file in GNOME3

Post by makhlaghi » 2014/09/13 01:25:10

This and other problems encouranged me to get a better understanding of GNU/Linux so I moved to Arch Linux, where I can essentially make my operating system my self, instead of relying on what RedHat provides me with. Fortuantely, being so closer to the upstream developers, this issue did not exist there. By simply putting the .desktop file in ~/.local/share/applications/, GNOME recognized the program and successfully opened the FITS image with SAO ds9.

chemal
Posts: 776
Joined: 2013/12/08 19:44:49

Re: [Solved] Setting a .desktop file in GNOME3

Post by chemal » 2014/09/13 02:01:00

Suit yourself.

Post Reply