[PC-BSD Dev] Gnome 3 mimetypes possible fix for PBI's

Joe Maloney jmaloney at pcbsd.org
Fri Feb 28 14:04:56 PST 2014


Ok.  I think I found the answer.  For gnome desktops ports can use
something like USES=desktop-file-utils is used for example in Mk/
bsd.gecko.mk.  Koop Mast pointed me to that one which tells the Firefox
port to update mimeinfo.  However at the bottom of that file a command is
ran called update-mime-database.  That commands scans the .desktop files
share/applications for mimetypes and builds the mimeinfo.cache database.
So for example the firefox port creates a .desktop file that contains the
following.

Terminal=false
Type=Application
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;

>From what I can tell so far the FireFox PBI's don't yet have this
mimeinfo.  So I think just adding this type of info to for example a
firefox pbi and adding a post install script to run the command
update-mime-database would rebuild the cache and do the trick if run as the
user.  However I'm not sure as PBI's install .desktop files in
.local/share/applications ran that /usr/share/applications if this would
work for sure but I would think it would.  I can grab some of your modules
and do some testing next week and see what happens.

Joe Maloney


On Fri, Feb 28, 2014 at 12:37 PM, Joe Maloney <jmaloney at pcbsd.org> wrote:

> Maybe xdg-mime is the answer.  I wonder why and how packages/ports update
> /usr/local/share/applications/mimeinfo.cache without any interaction.  I
> will have to look into that as well to see what I can find out.
>
> Joe Maloney
>
>
> On Fri, Feb 28, 2014 at 10:26 AM, Kris Moore <kris at pcbsd.org> wrote:
>
>>
>> So, the pbi system does try to register mime-types automatically. It uses
>> the "xdg-mime" command to register file-types and such, along with xdg-menu
>> and others for icons. I'm wondering if perhaps the fix is to update
>> xdg-mime/xdg-menu/xdg-desktop to work with however gnome3 wants its mime
>> data? Maybe we should check upsteam, perhaps they have been updated already?
>>
>>
>>
>> On 02/25/2014 12:44, Joe Maloney wrote:
>>
>>   Guys.  I think I may have came up with a better solution.  I was
>> looking at how packages behave regarding mimeinfo and packages write to
>> /usr/local/share/applications/mimeinfo.cache each time a package is
>> installed.  That's why packages show up in system-settings,details,default
>> applications in Gnome3.  I've noticed this file is much emptier with
>> fluxbox installed but it does exist with things like gimp set out of box.
>> As far as I can tell this file is generated by those installed packages and
>> not pc-extractoverlay?
>>
>>  So after installing Gnome3 I updated this file after determining what
>> the format should be from a pkg with the information for the firefox pbi.
>>
>> http://pastebin.com/e0az1pmL
>>
>>  Would it perhaps be better to have PBI's such as firefox, firefox-esr,
>> chromium, thunderbird, libreoffice*, openoffice* update mimeinfo.cache the
>> same way as packages when PBI's are installed?  This should also fix things
>> like libreoffice missing from Gnome's open with dialog.
>>
>>  The only side effect I think a user might see from this is that if
>> firefox is installed from pbi & pkg you might have 2 firefox options unless
>> the PBI title is renamed to FireFox PBI or something like that.  I suppose
>> I can still generate a mimeinfo.cache, or mimeapps.list file.  I just
>> thought this might be a cleaner way to do it per app instead going
>> forward.  Any thoughts?
>>
>> Joe Maloney
>>
>>
>>
>>
>>
>> On Mon, Feb 24, 2014 at 1:59 PM, Kris Moore <kris at pcbsd.org> wrote:
>>
>>>   On 02/24/2014 13:39, Joe Maloney wrote:
>>>
>>>  I've noticed this behavior for a long time with PBI's and Gnome 3.
>>>  Basically PBI's can't be set as default unless they are added to
>>> mimeapps.list.  Which appears to be something that only Gnome based
>>> desktops might use from what I can tell?  Here is an example file where I
>>> have added several PBI's into the file.  I could modify this file under
>>> /usr/local/share/applications (globally) or my home directory
>>> .local/share/applications.
>>>
>>>
>>> https://github.com/pkgdemon/freebsd-pkgdemon/blob/master/examples/gnome-mime-types/mimeapps.list-sample
>>>
>>>  You will see in this file I've added mime types for things like the
>>> web browser, which I had installed at the time via a PBI in an older
>>> version of PCBSD.  I'm wondering if it might not be a bad idea to create
>>> like a template /usr/local/share/applications/mimeapps.list that get's
>>> added with pc-extractoverlay that just has all of the common browsers, mail
>>> clients, etc.  This way a user could go into system-settings details within
>>> gnome and select a default browser and so on just like they could with a
>>> package.  I'm not entirely sure this will work yet or if I can add more
>>> than one entry per type in mimeapps.list.  I wanted to see if you guys
>>> might have any knowledge of it first and see what your thoughts were or if
>>> anyone might know of another way to solve this?
>>>
>>>  Joe Maloney
>>>
>>>
>>>
>>>  _______________________________________________
>>> Dev mailing listDev at lists.pcbsd.orghttp://lists.pcbsd.org/mailman/listinfo/dev
>>>
>>>
>>> I've had to do this in the past, so if GNOME requires it then it
>>> shouldn't be to much of a problem to do it again. Feel free to commit a fix
>>> to the pc-extractoverlay/ports-overlay directory with a sane list of
>>> "defaults" in /usr/local/share/applications/mimeapps.list. We can then test
>>> it in the Edge package set for a while, make sure it doesn't break any
>>> other DE's.
>>>
>>> --
>>> Kris Moore
>>> PC-BSD Software
>>> iXsystems
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev at lists.pcbsd.org
>>> http://lists.pcbsd.org/mailman/listinfo/dev
>>>
>>>
>>
>>
>> _______________________________________________
>> Dev mailing listDev at lists.pcbsd.orghttp://lists.pcbsd.org/mailman/listinfo/dev
>>
>>
>>
>> --
>> Kris Moore
>> PC-BSD Software
>> iXsystems
>>
>>
>> _______________________________________________
>> Dev mailing list
>> Dev at lists.pcbsd.org
>> http://lists.pcbsd.org/mailman/listinfo/dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pcbsd.org/pipermail/dev/attachments/20140228/6ae11414/attachment.html>


More information about the Dev mailing list