Ubuntu Registered Application Definition Explained

install-from-source

I've run into this a few times when installing apps from source, and during the occasional hack with update-alternatives. So far, it's only been a minor annoyance (ie, not got in the way of the end-goal) but it's now a frustration as it's pointing to a hole in my knowledge-base… so when I get a message that 'foo' is "not a registered application" (or I can't use foo's default icon cuz Ubuntu has no knowledge of 'foo'):

  1. What defines a "registered application"?

  2. How can I define an application installed from source (and likely residing in $HOME/bin/app-name) such that it packs the same functionality as a package installed from a .deb? (if the solution is not self-evident from answer 1)

Example:

I download and unpack daily dev builds of sublime-text-2 to /home/tom/bin/sublime-text-2. I've created a *.desktop file with appropriate shortcuts, etc. But the icon for sublime cannot be display in any launcher even if I provide a full pathname to the option. The solution is to install a 2nd instance of sublime from a deb package.

When I install sublime-text-2 from a .deb package, it installs under /usr/bin && /usr/lib, the installed .desktop file is stored under /usr/share/applications, and the relevant line reads: icon=sublime_text.

Where's the linkage I'm missing? Somehow Ubuntu knows how to exact the icon from sublime_text in the latter, but not in the former (again, even with a full path provided).

Best Answer

I think you are running into several problems at once with source installations.

update-alternatives will not allow you to set just any program as a preferred application for a given name. The program will have to be registered first with the --install option. For example:

sudo update-alternatives --set editor /home/peter/bin/foo
update-alternatives: error: alternative /home/peter/bin/foo for editor not registered, not setting.

If you want to see how the registration is done, check for example /var/lib/dpkg/info/nano.postinst.

Note, however, that it would be quite bogus to define a system-wide alternative that points to some user's home directory. There are usually environment variables or other settings to set a preference for one user only.

The issue with the desktop file is probably completely separate, but you will need to provide more details about exactly which paths you used.

In general, installing an application from source can be quite difficult to get well integrated with the rest of the system, depending on the particular application.

Related Question