Hi Bill and Jaap,

>> The Ubuntu Dash allows the input of search terms to select a file. This
>> can be used to identify a specific Zim page - quite a useful feature.
>> However, as Zim pages are stored as *.txt files, the Dash opens them in the
>> default text editor rather than Zim. This cancels out the usefulness :-).
yes, I realized the same a while ago -- it quite limits the usefulness
of the Zeitgeist integration as well (which makes recently used Zim
pages appear in the dash).

> Actually zim already does this. We install a rule in the mime type
> information database that matches the header in zim  page files.
>
> Unfortunately not all other applications respect this rule and give instead
> preference to the default rule for the .txt extension. Ubuntu file
> management being one such case where this rule is ignored.
I had a look at this issue a while ago and there did not seem to be an
easy solution apart from changing the file extension. I was about to
draft a bug report to the xdgmime library (which is ultimately used by
GNOME when deciding about the filetype) when I realized that there is
actually a problem in zim's mimetype specification: It does not define
the "*.txt" extension as a glob pattern. Looking at the GIO source
code the logic behind content type determination is:
* Get a list of possible mimetypes for the filename from xdgmime
* If none or more than one result is returned, look at the content of the file
The problem is that for .txt files, only one result is returned in the
first step, as only text/plain defines it as a glob pattern:
$ rgrep "*.txt" /usr/share/mime/packages/*.xml
/usr/share/mime/packages/freedesktop.org.xml:    <glob pattern="*.txt"/>

After adding the same line to /usr/share/mime/packages/zim.xml (and
updating the mime database), opening zim pages from the dash works
like a charm!

Thanks Bill for making me look into this again :)
Best,
  Marcel

_______________________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp

Reply via email to