Desktop Files

For a very goofy reason involving a bug with composer, and new warning messages in PHP, I decided I needed to reinstall eclipse on oregano. Reinstalling eclipse is always a test of my patience. During the entire course of my life I do not believe that the installation of eclipse along with the various components I need, especially subclipse, has ever “just worked”. There is always some issue. So, of course, I do not look forward to it with gleeful anticipation.

I think part of the problem for me – a problem of my own making I suppose – is that I mostly use distros (Fedora and Ubuntu) in which the packagers have already arranged for tools like eclipse to appear as “system level” rather than “user level” tools. By this I mean they appear (or are symlinked from) /usr/bin, their configuration files are located it /etc, their icons appear when you search for apps, etc. Whereas if you just use the upstream installers the installation will be carried out at the user level, they will ask you where to put the binary, and they will put configuration files in ~/.config,

So if there isn’t a sufficiently current distro package (and in my case there was not), and you need to use the eclipse installer, then you remove the system level package and install it as a user. This is not an earth-shattering insight. I should have figured it out long ago (but didn’t). But at least this time I knew that was what I had to do.

And having done that, now, of course, I had to build a desktop file. This is one of those few things about gnome where they have never been able to reach the level of “usability for the simple minded user” that is achieved with Mac OS and Windows. If you install a package you have to build a desktop file for the app, if you want to be able to click on an icon in gnome to launch it. For years I just couldn’t believe that there wasn’t some simple way to do this. I guess there is, in a way, I think alacarte will do it, but still, then you have to know about alacarte.

But after all these years, I know how to do this. Easy-peasey. Just create a desktop file in ~/.local/share/applications. Done it a hundred times. I did it. It didn’t work. Must have done something wrong… check, double check. WTF.?

I spent most of the day trying to figure this out. And it turns out to be because Fedora decided to implement Flatpak, which — bless them — they have done in order to make my life easier. I hate it when they do that. It always makes it substantially harder. Long story short, putting a desktop file in ~/.local/applications doesn’t work anymore.

Fedora has changed how they construct the environment variable XDG_DATA_DIRS, which contains the sequence of directories in which they will look for desktop files. They have done this, it seems, so that if you install packages using Flatpak they will be found. I do not know how they arrive at the list. I do not know for sure that I haven’t done something somewhere that caused the problem. What I do know is that on my system, the XDG_DATA_DIRS list was:

$HOME/.local/share/flatpak/exports/share/ :
/var/lib/flatpak/exports/share/ :
/usr/local/share/ :

This list, obviously, no longer includes the old standby value of $HOME/.local/share/applications, as it always used to do.

I was able to overcome the problem by adding to my .bash_profile:

export XDG_DATA_DIRS="$HOME/.local/share/applications: