Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magnet links can't open currently associated application #129

Closed
fulalas opened this issue Apr 27, 2017 · 36 comments
Closed

Magnet links can't open currently associated application #129

fulalas opened this issue Apr 27, 2017 · 36 comments

Comments

@fulalas
Copy link

fulalas commented Apr 27, 2017

I'm not sure if this is the right section.

Magnet links opened from inside the browser don't open Transmission Qt. I put this inside '/usr/share/applications/mimeinfo.cache':

[MIME Cache]
x-scheme-handler/magnet=transmission-qt.desktop;

And this inside '/usr/local/share/applications/defaults.list':

[Default Applications]
x-scheme-handler/magnet=transmission-qt.desktop;

It's important to notice that 'transmission-qt.desktop' exists and it's pointing to the right exec command. Also, Transmission Qt is working fine and it downloads magnets link if you paste inside it manually

@tsujan
Copy link
Member

tsujan commented Apr 27, 2017

@palinek, @luis-pereira

I think here is a good place to bring up a more general issue: There's a problem with scheme handlers in LXQt.

The same issue @fulalas has with magnet I have with mailto: it never opens Thunderbird but always Qupzilla. I added

x-scheme-handler/mailto=thunderbird.desktop;

to all places possible (~/.config/lxqt-mimeapps.list, ~/.config/mimeapps.list, ~/.local/share/applications/mimeapps.list) to no avail, so I stopped using it 2 years ago and forgot to look into it or even report it (there were more important issues those days).

That's while mailto works OK with KDE. Also xdg-email correctly opens Thunderbird. Only LXQt has problem.

Elsewhere, I discussed that perl-file-mimeinfo is needed by LXQt for opening links correctly. However. it seems that perl-file-mimeinfo is not enough in some cases.

@fulalas
Copy link
Author

fulalas commented Apr 27, 2017

Nice information, tsujan!

I would like to add that Firefox detects Transmission Qt and asks for opening magnet links with it, but Chrome-based browsers (Chromium and Opera, so far) just open a new tab.

Also, .m3u files (Winamp list type, used among so many audio/video players, like Vlc, Qmmp and SMPlayer) have a similar behavior: double-click on them from Pcmanfm-qt and nothing happens.

@tsujan
Copy link
Member

tsujan commented Apr 27, 2017

Oh, I forgot to confirm @fulalas's report. Because of that issue, I always drag and drop magnets into qBittorrent. Under KDE, they're correctly opened when they're clicked.

@fulalas, I think your problem with audio/video players is quite different.

(1) Have you added associations? You could use Configuration CenterFile Associations or add them directly to ~/.config/mimeapps.list (don't use ~/.local/share/applications/mimeapps.list).

(2) Have you installed libfile-mimeinfo-perl (on Debian based systems) or perl-file-mimeinfo (on Arch based ones)?

@fulalas
Copy link
Author

fulalas commented Apr 27, 2017

1- The way I did ('/usr/share/applications/mimeinfo.cache' and '/usr/local/share/applications/defaults.list'), when I open File Associations dialog, I see this: http://img.photobucket.com/albums/v256/Delerue/fileassociations_zpst0bfm7co.png

As you can see, there are 2 sections regarding m3u files. The second one (x-mpegurl) is already set to Qmmp. The first one (vnd.apple...?) isn't.

In a nutshell: this way it doesn't open Qmmp when I double-click a m3u file.

1.1- I would like to point to another little bug inside File Associations: if you add a new association, the dialog isn't refreshed, so you need to click on another file type and click again on the first one to see the changes.

2- I'm not sure. I'm using Porteus, which is derived from Slackware. Any suggestion?

@tsujan
Copy link
Member

tsujan commented Apr 27, 2017

In a nutshell: this way it doesn't open Qmmp when I double-click a m3u file.

Please forget about /usr/share/applications/ and ~/.local/share/applications/; especially the first one: it shouldn't be edited by users. Use ~/.config/mimeapps.list instead -- create it if it doesn't exist and add associations to it.

perl-file-mimeinfo seems to be perl-file-mimeinfo in Slackware.

Please let this report remain for x-scheme-handler.

If your problem with file associations isn't solved after doing what I said above, please first search for an open issue about it and add a comment; if there's no open issue, you could open one. However, I'm pretty sure that LXQt has no problem with file association. Its problem is only with scheme handlers.

@tsujan
Copy link
Member

tsujan commented Apr 27, 2017

BTW, we'd be grateful if you report the refresh problem too but not against pcmanfm-qt (report it here).

@fulalas
Copy link
Author

fulalas commented Apr 27, 2017

OK, I tried what you said (and it fixed .webp files not being opened by LXImage-qt, thanks) but the problem with .m3u files remains -- it simply doesn't open anything unless you right-click and 'Open with...'. :(

BTW, we'd be grateful if you report the refresh problem too but not against pcmanfm-qt (report it here).

It seems there is no 'issue' section on LXQt-Config page: https://github.com/lxde/lxqt-config/

@tsujan
Copy link
Member

tsujan commented Apr 27, 2017

For m3u files , I have:

[Added Associations]
...
audio/x-mpegurl=smplayer.desktop;vlc.desktop;featherpad.desktop;
...
[Default Applications]
...
audio/x-mpegurl=smplayer.desktop
...

in ~/.config/mimeapps.list.

@tsujan
Copy link
Member

tsujan commented Apr 27, 2017

It seems there is no 'issue' section on LXQt-Config page

Issues can be opened at https://github.com/lxde/lxqt/issues

@fulalas
Copy link
Author

fulalas commented Apr 28, 2017

OK, after a deeper investigation I finally began to understand the bug. The problem is a combination of 2 things, none of them related to mime stuff:

1- if the m3u file is inside a FAT/NTFS partition (it's always marked as executable and apparently you can't change this);
2- if Pcmanfm-qt preferences dialog has checked 'Don't ask options on launch executable file';

When these 2 things are set you won't be able to open a m3u file, since LXQt will try to execute it instead of opening it. So either you move your m3u files to a Linux partition (and change to non-executable) or uncheck Pcmanfm-qt 'Don't ask options on launch executable file'.

None of these solutions sound reasonable to me. Do you have a better solution?

@tsujan
Copy link
Member

tsujan commented Apr 28, 2017

All of my partitions are ext4 and even when I make an m3u file executable (which is meaningless), pcmanfm-qt correctly opens it with the associated media player when I choose "Open". As you said, your problem is with NTFS, not with mime.

Please be specific when reporting a bug, otherwise a lot of time and energy would be wasted!

@fulalas
Copy link
Author

fulalas commented Apr 28, 2017

Except that this m3u bug is secondary. The main reason this issue was opened is because of x-scheme-handler, specifically with magnet links. Do you think that I wasn't clear regarding this main bug? :(

@tsujan
Copy link
Member

tsujan commented Apr 28, 2017

Do you think that I wasn't clear regarding this main bug?

I meant the second bug you included in this report, of course. We had a long discussion about it to no avail -- as we had at lxqt/pcmanfm-qt#487 -- just because some important facts weren't stated.

@fulalas
Copy link
Author

fulalas commented Apr 28, 2017

I'm sorry, but users don't have all the knowledge you expect them to have. This one regarding m3u files was very specific and I bet even you wasn't aware of it entirely.

All debate is valid. Living and learning. 👍

@tsujan
Copy link
Member

tsujan commented Apr 28, 2017

users don't have all the knowledge you expect them to have.

We really don't expect users to have any knowledge about programming. What we prefer is a bug report that contains specific info because otherwise false problems would be created.

This one regarding m3u files was very specific

Not at all! Maybe, even now, you haven't stated it clearly? As far as I understood, it was only about files on an NTFS partition. It wouldn't require any knowledge to include that part in the report -- and it would make a great difference.

Anyhow, being specific is not an expectation but a request that if met, good things could happen.

@tsujan
Copy link
Member

tsujan commented Apr 28, 2017

To be as clear as possible, if, in lxqt/pcmanfm-qt#487, you just mentioned that there was a dialog, many things would be clear from the start. I hope you'll report bugs that we don't know about; I just like to see more specific reports from you -- like this one, except for the m3u part. Actually, on this page, you could see how good a clear report is.

@tsujan
Copy link
Member

tsujan commented Apr 28, 2017

I opened lxqt/pcmanfm-qt#492, which is related to your m3u problem but your problem has another side too, i.e. files are excuatable on your NTFS partition. This part shouldn't be about LXQt but, perhaps, about how that NTFS partition is mounted.

If those files are NOT seen as executable files by another file manager, please open an issue with a title like "pcmanfm-qt sees all files executable on NTFS partitons". Sorry, I can't have any NTFS partition!

@luis-pereira
Copy link
Member

@fulalas Which browser are you using ?

@luis-pereira
Copy link
Member

Chrome/Chromium uses, AFAIK, xdg-open to find which application to use.
To check what application is the current default use:
xdg-mime query default x-scheme-handler/magnet

To set it, use:
xdg-mime default transmission-qt.desktop x-scheme-handler/magnet

@tsujan
Copy link
Member

tsujan commented Apr 29, 2017

@luis-pereira
As for mailto, xdg-mime query default x-scheme-handler/mailto gives thunderbird.desktop here and, as I said above, xdg-email gracefully opens Thunderbird email composing page but mailto links are wrongly "opened" by Qupzilla.

@fulalas
Copy link
Author

fulalas commented Apr 29, 2017

@luis-pereira, I'm using Opera (Chromium-based). If I execute the first command you told me this is what terminal prints:
transmission-qt.desktop

And if I execute the second command I receive this:

touch: cannot touch '/home/guest/.local/share/applications/mimeapps.list': No such file or directory
/usr/bin/xdg-mime: line 827: /home/guest/.local/share/applications/mimeapps.list.new: No such file or directory

Then I made a copy of my mimeapps to '/home/guest/.local/share/applications/' and ran the second command again, receiving no output whatsoever. Unfortunately the problem remains: clicking on a magnet link inside Opera/Chromium simply opens a new tab instead of Transmission Qt. :(

@fulalas
Copy link
Author

fulalas commented May 1, 2017

@tsujan
Copy link
Member

tsujan commented May 1, 2017

At least for mailto, I see the problem as an LXQt bug because mailto works OK with KDE.

@fulalas
Copy link
Author

fulalas commented May 1, 2017

I don't know. Maybe KDE handles this problem.

@tsujan
Copy link
Member

tsujan commented May 1, 2017

I don't know. Maybe KDE handle this problem.

Then LXQt should do so too. My point: this is a bug.

@luis-pereira
Copy link
Member

@tsujan If xdg-open does the correct thing, it's not a LXQt bug but rather someone else's bug that LXQt should fix.
Consider this, under LXQt:
xdg-open 'magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&xt=urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY&xt=urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q&xl=10826029&dn=mediawiki-1.15.1.tar.gz&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&xs=http%3A%2F%2Fcache.example.org%2FXRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5&xs=dchub://example.org'
it opens a new instance of chromium.
now do:
export DE="xfce"
and repeat the above command. In my system ir correctly open transmission.
@tsujan The real issue here is that xdg only recognizes: gnome, kde, xfce, lxde and mate.

I remember that a try was made to include lxqt in the list. But without success. Will try to find it.

@tsujan
Copy link
Member

tsujan commented May 1, 2017

@tsujan The real issue here is that xdg only recognizes: gnome, kde, xfce, lxde and mate.

Yes, this is what I also concluded a year ago. If lxde is recognized, lxqt should be included too.

Here, I was hoping for a workaround. If I said it was an LXQt bug, I meant it on the UX level -- but you're right, on the technical level.

@luis-pereira
Copy link
Member

@tsujan
Update:
The latest git already as some LXQt support, see commit https://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=6387086e4938d568c2bab185632f60e1619b3f68.

Didn't install it yet. But, by looking at the source.... it probably works.

@tsujan
Copy link
Member

tsujan commented May 1, 2017

@agaida that's good news.

@luis-pereira
Copy link
Member

@tsujan @agaida @fulalas The latest git xdg-utils actually correctly open magnet links from chromium.
Awesome news.

@tsujan
Copy link
Member

tsujan commented May 1, 2017

Ah, at last! mailto is fixed too :) Glad to see that both LXQt and Enlightenment are recognized!

@luis-pereira, thanks for the info!

This can be closed because, sooner or later, the git xdg-utils will come to all distros.

@tsujan tsujan closed this as completed May 1, 2017
@tsujan
Copy link
Member

tsujan commented May 9, 2017

Actually, xdg-utils 1.1.2 is a mess regarding LXQt: although magnet and mailto are fixed, xdg-open thinks that all links starting with file:// (for example, fie:///.../XXX.pdf) should be opened by pcmanfm (and not even pcmanfm-qt) under LXQt. Shouldn't we tell them about that?

@agaida
Copy link
Member

agaida commented May 9, 2017

we should, it's boring

@tsujan
Copy link
Member

tsujan commented May 10, 2017

we should, it's boring

I agree. Fortunately, 1.1.2 isn't released yet.

Let me explain the problem:

The fact that pcmanfm-qt opens files with their corresponding apps doesn't prove that xdg-utils is OK. Qt has the static method QDesktopServices::openUrl(), which can be used to know if xdg-utils works fine under a DE.

With xdg-utils 1.1.1 and if perl-file-mimeinfo is installed, QDesktopServices::openUrl() opens all URLs correctly. With xdg-utils 1.1.2, it tries to open all file:///... URLs with pcmanfm -- because xdg-utils wants to do so -- and therefore, it fails.

@tsujan
Copy link
Member

tsujan commented May 11, 2017

The disaster happened; xdg-utils 1.1.2 came to Arch (and Manjaro) with its LXQt-friendly appearance. I have to change:

    lxde|lxqt)
    open_lxde "$url"
    ;;

to

    lxde|lxqt)
    open_generic "$url"
    ;;

in /usr/bin/xdg-open for xdg-open to open a pdf file correctly under LXQt, for example!! Without this change, it gives this error message:

/usr/bin/xdg-open: line 922: pcmanfm: command not found

Please tell them (I would if I knew of the best way to do it)!

@tsujan
Copy link
Member

tsujan commented May 11, 2017

Opened lxqt/lxqt#1298

@agaida agaida added this to test in Issues Aug 11, 2018
@agaida agaida added this to Done in Issues Nov 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Issues
  
Translations and L10N
Issues
  
Done
Development

No branches or pull requests

4 participants