Re: [e-users] xdg-open troubles

2018-11-05 Thread The Rasterman
On Sun, 4 Nov 2018 14:44:59 + Peter Flynn  said:

> On 04/11/2018 13:14, Carsten Haitzler (The Rasterman) wrote:
> [...]
> > it'll pick one of whatever app says it can open that mime type...
> > whatever comes first that it finds,
> 
> That was my understanding also. But it doesn't:
> 
>   * /usr/share/applications/mimeinfo.cache says (simplified)
> application/pdf=qpdfview.desktop;evince.desktop;gimp.desktop;
> because *I* want them to open with qpdfview but evince disagreed
> *and then* GIMP stuck its oar in and added itself

that is normal. all tjhese apps say they can load a pdf, so they are on the
list of candidates. one of the candidate list is chosen by e - whatever it
finds first in its in-memory data structures, UNLESS you have explicitly set
one via settings OR used efm to "open with" a specific one, then that is used.

>   * if I type the command xdg-open foobar.pdf it opens in evince
> 
>   * if I double-click on foobar.pdf in efm it opens in qpdfview
> 
>   * if the genealogical application Gramps generates a PDF report,
> it opens GIMP to display it!

i tested this myself just before i wrote my last mail and xdg-open followed
what enlightenment_open does...

perhaps your system's xdg-open is old and doesn't support enlightenment? try
using enlightenment_open instead  it should be consistent.

the xdg tools are heavily hard-coded for specific desktop support. xdg-open is
just a shell script, so have a read :) perhaps you need to upgrade OS/XDG tools?

> Obviously E is doing it right and the others are wrong :-)
> 
> > UNLESS you happen to change that. and it's as simple as opening that 
> > mime type via efm and using "open with" ... and selecting the 
> > appropriate app, then it'll use whatever you last happened to use 
> > there as that becomes your preferred opener of that type.
> Part of the problem is that I hardly ever use GUI file managers, and if
> I do it's usually caja.

well then you get the settings dialog with the massive list of mime types to
have fun with. :)

> > you could beat your head against the massive default applications 
> > dialog and manually select there mime type by mime type... but just
> > using efm is the simplest way...
> 
> Yes, but fortunately it was only to mime types and both the bogus
> associations were made by one application. I have added the relevant
> commands to my setup script for installing new systems now, so I
> shouldn't have any more trouble.

it is possible the app is not using xdg-open and doing its own thing
(enlightenment does its own thing ... well chicken-and-egg problem. xdg-open
these days relies on enlightenment to do the opening and  e will use
~/.config/mimeapps.list | ~/.local/share/applications/defaults.list files
(mimeapps first if found, otherwise fallback to defaults.list). e will write
all config these days into the mimeapps.list file. some time ago (i don't know
when) xdg decided to change from the defaults.list file to the mimeapps.list
scheme. e will auto-upgrade you to the new scheme if you don't have a
mimeapps.list file bu just copying defaults.list over to there. perhaps it's
something related to some apps using the sold scheme and some the new, maybe
xdg-open not supporting enlightenment ... perhaps a combination of the 2?

> Thanks for your help.
> 
> ///Peter
> 
> 
> ___
> enlightenment-users mailing list
> enlightenment-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-users
> 


-- 
- Codito, ergo sum - "I code, therefore I am" --
Carsten Haitzler - ras...@rasterman.com



___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] xdg-open troubles

2018-11-04 Thread Peter Flynn
On 04/11/2018 13:14, Carsten Haitzler (The Rasterman) wrote:
[...]
> it'll pick one of whatever app says it can open that mime type...
> whatever comes first that it finds,

That was my understanding also. But it doesn't:

  * /usr/share/applications/mimeinfo.cache says (simplified)
application/pdf=qpdfview.desktop;evince.desktop;gimp.desktop;
because *I* want them to open with qpdfview but evince disagreed
*and then* GIMP stuck its oar in and added itself

  * if I type the command xdg-open foobar.pdf it opens in evince

  * if I double-click on foobar.pdf in efm it opens in qpdfview

  * if the genealogical application Gramps generates a PDF report,
it opens GIMP to display it!

Obviously E is doing it right and the others are wrong :-)

> UNLESS you happen to change that. and it's as simple as opening that 
> mime type via efm and using "open with" ... and selecting the 
> appropriate app, then it'll use whatever you last happened to use 
> there as that becomes your preferred opener of that type.
Part of the problem is that I hardly ever use GUI file managers, and if
I do it's usually caja.

> you could beat your head against the massive default applications 
> dialog and manually select there mime type by mime type... but just
> using efm is the simplest way...

Yes, but fortunately it was only to mime types and both the bogus
associations were made by one application. I have added the relevant
commands to my setup script for installing new systems now, so I
shouldn't have any more trouble.

Thanks for your help.

///Peter


___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] xdg-open troubles

2018-11-04 Thread The Rasterman
On Fri, 2 Nov 2018 19:21:36 + Peter Flynn  said:

> xdg-open calls enlightenment_open to open a file with its nominated
> handler. On my system, PDFs open with GIMP for some unfathomable reason,
> and all my browsers are incapable of calling Thunderbird to open mailto:
> links.
> 
> How does enlightenment_open work? I must presumably be able to set each
> filetype to open with the correct application somehow. Is there a config
> file I can edit to force it to use the right applications?
> 
> (And then preferably lock it down hard so that any applications I
> install in the future don't try to mess with the settings, which I
> suspect is why it's broken...)

it'll pick one of whatever app says it can open that mime tyope... whatever
comes first that it finds, UNLESS you happen to change that. and it's as simple
as opening that mime type via efm and using "open with" ... and selecting the
appropriate app, then it'll use whatever you last happened to use there as that
becomes your preferred opener of that type. you could beat your head against
the massive default applications dialog and manually select there mime type by
mime type... but just using efm is the simplest way...


-- 
- Codito, ergo sum - "I code, therefore I am" --
Carsten Haitzler - ras...@rasterman.com



___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] xdg-open troubles

2018-11-04 Thread Jérémy Zurcher
On Saturday 03 November 2018  11:49, Peter Flynn wrote :
> On 03/11/2018 09:04, Jérémy Zurcher wrote:
> > Hi,
> > 
> > you should first debug xdg-...
> > 
> > XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default 'text/html'
> 
> OK.
> 
> > XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default 'bad/wrong' -> to see what 
> > files are read
> 
> Now *that* was enormously useful, thank you. Pipe std.err and tweak it
> to be a grep for 'pdf', execute the lines, then grep the output for
> 'gimp'...eg
> 
> XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default 'bad/wrong' 2>&1 | sed -e
> "s+Checking+grep -iH pdf+" -e "s+ and + +"| bash | grep -i gimp

Now *that* is new to me, I never thought of piping into bash !!!

> 
> and it turns up:
> 
> /usr/share/applications/mimeinfo.cache:application/pdf=qpdfview.desktop;evince-previewer.desktop;evince.desktop;kde4-okularApplication_pdf.desktop;xreader.desktop;texworks.desktop;gimp.desktop;
> /usr/share/applications/mimeinfo.cache:application/postscript=qpdfview.desktop;evince-previewer.desktop;evince.desktop;kde4-okularApplication_ghostview.desktop;xreader.desktop;gimp.desktop;
> 
> Clearly something has been meddling with the settings for no good reason.
> 
> > so on a 'regular setup' everything boils down to : .config/mimeapps.list
> 
> That seems to be clean, but /usr/share/applications/mimeinfo.cache
> isn't. Can I just delete it manually, or is there a procedure to flush
> it out?
> 
> ///Peter
> 
> 
> ___
> enlightenment-users mailing list
> enlightenment-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-users
--- Hell'O from Yverdoom

Jérémy (jeyzu)


___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] xdg-open troubles

2018-11-03 Thread Peter Flynn


On 03/11/2018 18:28, Ross Vandegrift wrote:
> On Sat, Nov 03, 2018 at 05:19:13PM +, Peter Flynn wrote:
>> On 03/11/2018 11:49, Peter Flynn wrote:
>> [...]
>>> That seems to be clean, but /usr/share/applications/mimeinfo.cache
>>> isn't. Can I just delete it manually, or is there a procedure to flush
>>> it out?
>>
>> I just edited it and removed the bogus association for GIMP.
> 
> See update-desktop-database(1) for more info on what generates these.

Thanks for the pointer. Now I can see where it came from.

>> All working fine (but of course I have no idea what random application
>> was the cause). Many applications make a land-grab for their pet MIME
>> media-type and happily stomp on the associations that a user prefers.
> 
> Apps list their supported mime types in their .desktop file.  That's how file
> managers get a reasonable list of apps that support a given file.  So gimp 
> gets
> associated with application/pdf since gimp's .desktop file indicates that it
> can handle PDFs.

It's a matter of degree, and update-desktop-database cannot possibly
know when an application is being economical with the truth.

GIMP only "supports" PDF and Postscript in the sense that it can import
a page as a bitmap. GIMP cannot "open" a PDF or Postscript file in the
normal sense of the word.

I have edited the gimp.desktop files in both locations and removed the
application/pdf and application/postscript to prevent the problem
reoccurring.

> In an E session, does your env have XDG_CURRENT_DESKTOP=enlightenment?  

Yes, but it's capitalised (Enlightenment).

> If not, xdg-open may be falling back to a handler that doesn't pick
> up your Enlightenment config.

That was certainly a problem in earlier versions of xdg-open but I think
so many people complained that they fixed it. The code now tests for
both ENLIGHTENMENT and Enlightenment but not enlightenment.

///Peter


___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] xdg-open troubles

2018-11-03 Thread Ross Vandegrift
On Sat, Nov 03, 2018 at 05:19:13PM +, Peter Flynn wrote:
> On 03/11/2018 11:49, Peter Flynn wrote:
> [...]
> > That seems to be clean, but /usr/share/applications/mimeinfo.cache
> > isn't. Can I just delete it manually, or is there a procedure to flush
> > it out?
> 
> I just edited it and removed the bogus association for GIMP.

See update-desktop-database(1) for more info on what generates these.

> All working fine (but of course I have no idea what random application
> was the cause). Many applications make a land-grab for their pet MIME
> media-type and happily stomp on the associations that a user prefers.

Apps list their supported mime types in their .desktop file.  That's how file
managers get a reasonable list of apps that support a given file.  So gimp gets
associated with application/pdf since gimp's .desktop file indicates that it
can handle PDFs.  See /usr/share/applications/gimp.desktop, at the bottom.

In an E session, does your env have XDG_CURRENT_DESKTOP=enlightenment?  If not,
xdg-open may be falling back to a handler that doesn't pick up your
Enlightenment config.

Ross


___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] xdg-open troubles

2018-11-03 Thread Peter Flynn
On 03/11/2018 11:49, Peter Flynn wrote:
[...]
> That seems to be clean, but /usr/share/applications/mimeinfo.cache
> isn't. Can I just delete it manually, or is there a procedure to flush
> it out?

I just edited it and removed the bogus association for GIMP.

All working fine (but of course I have no idea what random application
was the cause). Many applications make a land-grab for their pet MIME
media-type and happily stomp on the associations that a user prefers.

///Peter


___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] xdg-open troubles

2018-11-03 Thread Peter Flynn
On 03/11/2018 09:04, Jérémy Zurcher wrote:
> Hi,
> 
> you should first debug xdg-...
> 
> XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default 'text/html'

OK.

> XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default 'bad/wrong' -> to see what 
> files are read

Now *that* was enormously useful, thank you. Pipe std.err and tweak it
to be a grep for 'pdf', execute the lines, then grep the output for
'gimp'...eg

XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default 'bad/wrong' 2>&1 | sed -e
"s+Checking+grep -iH pdf+" -e "s+ and + +"| bash | grep -i gimp

and it turns up:

/usr/share/applications/mimeinfo.cache:application/pdf=qpdfview.desktop;evince-previewer.desktop;evince.desktop;kde4-okularApplication_pdf.desktop;xreader.desktop;texworks.desktop;gimp.desktop;
/usr/share/applications/mimeinfo.cache:application/postscript=qpdfview.desktop;evince-previewer.desktop;evince.desktop;kde4-okularApplication_ghostview.desktop;xreader.desktop;gimp.desktop;

Clearly something has been meddling with the settings for no good reason.

> so on a 'regular setup' everything boils down to : .config/mimeapps.list

That seems to be clean, but /usr/share/applications/mimeinfo.cache
isn't. Can I just delete it manually, or is there a procedure to flush
it out?

///Peter


___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] xdg-open troubles

2018-11-03 Thread Jérémy Zurcher
Hi,

you should first debug xdg-...

XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default 'text/html'

XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default 'bad/wrong' -> to see what files 
are read

the enlightenment side is :
src/bin/e_open.c:116  snprintf(path, sizeof(path), "%s/mimeapps.list", 
efreet_config_home_get());

- efreet_config_home_get()

https://www.enlightenment.org/_legacy_embed/group__Efreet__Base.html#ga6e9d83cdc5955f464ee2eab946c62e06
$XDG_CONFIG_HOME or $HOME/.config

so on a 'regular setup' everything boils down to : .config/mimeapps.list



On Friday 02 November 2018  23:31, Peter Flynn wrote :
> On 02/11/2018 21:05, Ross Vandegrift wrote:
> > On Fri, Nov 02, 2018 at 07:21:36PM +, Peter Flynn wrote:
> >> xdg-open calls enlightenment_open to open a file with its nominated
> >> handler. On my system, PDFs open with GIMP for some unfathomable reason,
> >> and all my browsers are incapable of calling Thunderbird to open mailto:
> >> links.
> > 
> > Settings -> Apps -> Default applications.  Email is in the Core tab.
> > Other cases are listed by mime type in the General tab.
> 
> Thank you...as I thought, Email is already set to Thunderbird and
> application/pdf is already set to Document Viewer.
> 
> 1. But if I type
> 
>xdg-open foobar.pdf
> 
> it opens GIMP (ie behaviour is false, but it's what the applications are
> doing). BTW file -i correctly identifies PDF files as application/pdf
> 
> 2. If I type
> 
>xdg-open mailto:pe...@silmaril.ie
> 
> a Thunderbird Compose window opens (ie behaviour is correct, but all my
> browsers fail to invoke it).
> 
> Is it possible that for [1] something is overriding the file identity?
> 
> ///Peter
> 
> 
> 
> ___
> enlightenment-users mailing list
> enlightenment-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-users
--- Hell'O from Yverdoom

Jérémy (jeyzu)


___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] xdg-open troubles

2018-11-02 Thread Peter Flynn
On 02/11/2018 21:05, Ross Vandegrift wrote:
> On Fri, Nov 02, 2018 at 07:21:36PM +, Peter Flynn wrote:
>> xdg-open calls enlightenment_open to open a file with its nominated
>> handler. On my system, PDFs open with GIMP for some unfathomable reason,
>> and all my browsers are incapable of calling Thunderbird to open mailto:
>> links.
> 
> Settings -> Apps -> Default applications.  Email is in the Core tab.
> Other cases are listed by mime type in the General tab.

Thank you...as I thought, Email is already set to Thunderbird and
application/pdf is already set to Document Viewer.

1. But if I type

   xdg-open foobar.pdf

it opens GIMP (ie behaviour is false, but it's what the applications are
doing). BTW file -i correctly identifies PDF files as application/pdf

2. If I type

   xdg-open mailto:pe...@silmaril.ie

a Thunderbird Compose window opens (ie behaviour is correct, but all my
browsers fail to invoke it).

Is it possible that for [1] something is overriding the file identity?

///Peter



___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] xdg-open troubles

2018-11-02 Thread Ross Vandegrift
On Fri, Nov 02, 2018 at 07:21:36PM +, Peter Flynn wrote:
> xdg-open calls enlightenment_open to open a file with its nominated
> handler. On my system, PDFs open with GIMP for some unfathomable reason,
> and all my browsers are incapable of calling Thunderbird to open mailto:
> links.

Settings -> Apps -> Default applications.  Email is in the Core tab.
Other cases are listed by mime type in the General tab.

Ross


___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


[e-users] xdg-open troubles

2018-11-02 Thread Peter Flynn
xdg-open calls enlightenment_open to open a file with its nominated
handler. On my system, PDFs open with GIMP for some unfathomable reason,
and all my browsers are incapable of calling Thunderbird to open mailto:
links.

How does enlightenment_open work? I must presumably be able to set each
filetype to open with the correct application somehow. Is there a config
file I can edit to force it to use the right applications?

(And then preferably lock it down hard so that any applications I
install in the future don't try to mess with the settings, which I
suspect is why it's broken...)

///Peter


___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users