
Hi Alex, On Thu, Jun 13, 2024 at 05:52:55PM +0200, a1ex@dismail.de wrote:
Hi Rodrigo and list,
Thanks for all the recent improvements!
I have one more feature which I would like to propose, or hopefully at least get some guidance with. An option to open a link with an external program. This could be a custom downloader, or whatever else the user wants.
Ideally it would be a setting in dillorc, something like: external_downloader="/usr/bin/some_command -x -y -z"
And in the right-click Link menu there would be an option to open the link with the external program, something like "Open link with external app".
I can envision various workflows, especially repetitive ones, in which this would be a real time-saver. There is nothing really wrong with the built-in downloader, but it's not always ideal. Obviously it's possible to copy the link and use it in whatever program, but that results in extra clicks / key-presses.
Is there any interest in a feature like this?
Certainly!, it is one of the firsts issues I opened back in 2020: https://github.com/dillo-browser/dillo/issues/3 However, there are several concerns that we may want to take into account. When downloading a file, it is often not only the URL what is needed to retrieve it. A lot of sites require the session cookies and less frequently the user agent. So it would be nice to allow passing that information to the external tool. It may be nice to have multiple options, so for example I could define an action for YouTube videos and another for PDF files. However, I would like to support a workflow in which specific URLs are matched and the appropriate tool is selected to handle it. For example, I could open YouTube URLs directly into MPV (or similar) by just clicking on a link without even going to the "right-click > open in MPV" menu. This has the problem that sometimes the URL is not enough, you need to determine other things. For example, the server may reply that the URL I just clicked on is in fact a PDF. It would be nice to be able to tell Dillo to download the file and open it in my PDF viewer *after* the server has replied with the MIME type. It should be posible to directly pipe the server reply into the tool, no need to wait for the download to finish. There is an issue to cover this (and other things): https://github.com/dillo-browser/dillo/issues/56 Those tools may not only take care of downloading the file, they can also perform some substitutions in HTML or CSS files and send them back to Dillo, allowing arbitrary modifications of pages. Now, going back to your specific case, it may be good to have a simpler solution first that can later be extended to the more general approach, so we don't have to wait too long. I have some ideas of how to do it, but I would like to ask you to give concrete examples of that feature so I can test it with those programs.
I've been looking at the source, but am not really seeing a way to easily replace the current download program (or even where it is defined). If anyone has hints on how to do this, I'd appreciate the help. Or, even better, someone more talented could step up and implement the feature :)
A similar feature has been implemented in dilloNG: https://github.com/w00fpack/dilloNG/commit/7bd6b1c4592466d6e717eaf795e98b7ce... But as it is currently implemented is not very extensible, only a "media player" and a "media downloader" options are posible. Best, Rodrigo.