[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Trouble with xdg-open and mimetypes

Squeeze (x86_64, recently installed). Desktop environment is LXDE, though 
with a few GNOME applications in the mix.

I am having some trouble with xdg-open. I try a simple example:

walterh@saturn:~/log$ xdg-open backup.log
Warning: unknown mime-type for "backup.log" -- using "application/octet-
Error: no "view" mailcap rules found for type "application/octet-stream"

So it looks as though there is some information missing about how to 
handle various mimetypes. After a bit of searching and perusing man 
pages, I come to this:

walterh@saturn:~/log$ xdg-mime query filetype backup.log
text/plain; charset=us-ascii

Evidently it knows that the file is type text/plain (presumably from the 
magic number).

walterh@saturn:~/log$ xdg-mime query default text/plain

It appears then, that there is no default application for mimetype text/

The xdg-mime man page tells me that to register an application as default 
for a given mimetype, I should do this:

walterh@saturn:~/log$ xdg-mime default gedit.desktop text/plain

I do so, and note that a new file has been created:

walterh@saturn:~/log$ cat ~/.local/share/applications/defaults.list
[Default Applications]

and that xdg-open backup.log now opens the file in gedit.

OK, now to make it the systemwide default. After verifying that this is 
the only defaults.list in the entire filesystem, I try:

sudo mv ~/.local/share/applications/defaults.list /usr/share/applications
walterh@saturn:~/log$ sudo updatedb
walterh@saturn:~/log$ locate defaults.list

Indeed, xdg-open backup.log still works.

So my questions are:
Why was this file not installed and built for me as packages were 
Surely I shouldn't need to build this file by hand?
Is there a package missing? I am sure that I have never deleted the file.

Reply to: