open link with external program from context menu Topic is solved

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

Lew Rockwell Fan

open link with external program from context menu

Unread post by Lew Rockwell Fan » 2017-10-08, 05:52

There are Ffx addons that purport to do this. I've tried them all. It could be I messed up by forcing the installation of one of them, which I can't uninstall now, & conceivably that may have prevented the ones I tried after that from working. So I'm going to purge Pale Moon, reinstall, and try again.

But before I do, it would be nice to know if anyone has had success with any approach to getting an "open with ____" item added to the context menu (atm, I'm specifically looking to add a script to the context menu for links so it would be invoked "myscript some_web_page.htm", but conceivably a more general purpose tool might include this ability). If I knew that somebody using PM under a linux had success with some particular approach I'd try that first before I break it again ;-). Filling in the blank for the script name could be done with a config file perhaps.

Anybody here been able to make something like that work?

User avatar
FranklinDM
Add-ons Team
Add-ons Team
Posts: 580
Joined: 2017-01-14, 02:40
Location: Philippines
Contact:

Re: open link with external program from context menu

Unread post by FranklinDM » 2017-10-08, 06:08

I'm not sure if this is what you're looking for, but this add-on can open links in other programs (and you can set your own also):
Browser View Plus

Lew Rockwell Fan

Re: open link with external program from context menu

Unread post by Lew Rockwell Fan » 2017-10-08, 06:54

Thanks. I've seen that. It's Windows only I believe. I've tried all the obvious choices. Most just didn't work. One of them (I forget, I think it was Launchy) broke my PM when I forced the installation. Now I've made a fresh installation and I'm trying a second round, cautiously.

I was too prolix. The heart of the question is:

Has anybody here, "using PM under a linux had success with some particular approach"?

If not, I'll try them all again for the reasons I named, but if I KNEW a particular approach actually worked for somebody, not merely that it is supposed to, I'd concentrate on that first.

tooshorttoolong
Fanatic
Fanatic
Posts: 137
Joined: 2017-09-11, 14:28

Re: open link with external program from context menu

Unread post by tooshorttoolong » 2017-10-08, 11:46

You can try Open With v5.6.3.1 (you can launch any program with it, not just web browsers), or Watch with MPV which again lets you run any command you want.

To install Watch with MPV you need to install Moon Tester Tool, download the xpi for Watch with MPV, and open the xpi from Moon Tester Tool.

Lew Rockwell Fan

Re: open link with external program from context menu

Unread post by Lew Rockwell Fan » 2017-10-08, 17:51

Thank you, Tooshorttoolong.

I've tried "Open With", Version 5.6.3.1-signed. I've tried every extension that purports to do this.

"Watch with MPV" does look . . . interesting, but, just going by the description, it doesn't seem to claim to do what I'm asking at all.

Correct me if I'm wrong, but it sounds like it acts only on links to pages with videos on youtube & some other tube sites, then, rather than passing the link to my chosen program, downloads the video from that page with youtube-dl, and THEN opens the downloaded VIDEO with the application of choice, not the same thing at all.

I'm looking for a more general purports tool that shows up on the context menu for ANYTHING under the pointer in the "client" area (meaning the web page inside PM as opposed to some part of PM's own ui, like a toolbar) when it is right clicked, not just links to video pages, and then, if clicked, acts on whatever item was right clicked, with my own script.

Ideally it could act on ANY element of a web page, for example an image, some highlighted text, an entry field, a link, whatever. However, if it only acted on links, that would still be very useful, but at minimum I'm looking for something that would copy THE LINK (i.e., a string like "https://someplace.org") and invoke my script with that string as the argument.

THE QUESTION IS:
Has anyone here actually successfully USED, not read about, an extension in Pale Moon running in a linux, that will do this?

I'll continue tinkering in any case, but if anyone can tell me something like "I used Joe's extension in PM under Mandriva to do this and it WORKED," then that approach goes to the head of my list to try to get working.

Perhaps I should mention that "Menu Wizard" should be able to do this, but the add-new-item-to-main-context-menu feature doesn't work for me. Does a failure of one feature justify suggesting adding it to the "know incompatibles" list? Other parts of it may work. Dunno.

I've made a kludgy, fragile hack that checks for a change in the xclip clipboard following any right click in the client area. It runs automatically if I select "copy" or "copy link" quickly enough, but that impairs the normal functions of "copy" & "copy link" in that I have to answer a dialog to say "no, I don't want to run this script - I just want to copy something" & it fails if I hesitate too long.

Thanks.

tooshorttoolong
Fanatic
Fanatic
Posts: 137
Joined: 2017-09-11, 14:28

Re: open link with external program from context menu

Unread post by tooshorttoolong » 2017-10-08, 19:20

You can speculate all you want, but I answered your question.

Lew Rockwell Fan

Re: open link with external program from context menu

Unread post by Lew Rockwell Fan » 2017-10-09, 00:10

Actually, no. You didn't explicitly say if you have successfully used with PM in a linux, either of those extensions to add a "open what's under the pointer with this local script" entry to the main context menu & that's all I'm asking. You just suggested I might try them, & I appreciate your suggestions, but that wasn't the question. I'm not speculating about anything.

"Open With" is supposed to do that & I've tried it, as I've said. If anyone explicitly says "I used it for that & it worked for me with PM under a linux," it will move to the top of my list to retry. Right now I'm retrying with Menu Wizard.

But unless the description on the "Watch with MPV" page at Mozilla,

https://addons.mozilla.org/en-US/firefo ... src=search

is completely wrong, it does a totally different thing. It is a dedicated video downloader for youtube & some similar sites, using youtube-dl (which is a program I use actually) which then ACTS ON THE DOWNLOADED VIDEO with the program of your choice, which could be a script, but that is a totally different thing.

A video file available on the page a link points to is not the same thing as the page, and the page isn't the same thing as the link itself, which is all I'm after - just a string obtainable in a fraction of a second because it already exists locally as part of the page you're looking at, without even downloading the page with the video, let alone the video itself. Perhaps the description is wrong but that seems pretty clearly what the description says. If you are saying the description is wrong and it can be configured to use something other than youtube-dl, and that you have done this, then I'll try it. But if you are just "speculating" that that can be done, I'll leave it at the bottom of my list of things to try, because using Moon Tester Tool to force install something (Launchy, I think it was) is what broke my PM earlier today.

Even if I settle for something that just deals with links, & not, for example highligted text, or a blank area of the page, I'd want something equivalent to:
1. copy link
2. /path/to/local/script "$(xclip -selection clipboard -o)"

I'm not looking for something that only recognizes links to pages hosting videos on a tube site, let alone automatically download them. Actually, what I'm working on now would append the link (a string) to a text file, but I'm looking for a general purpose tool.

Lew Rockwell Fan

Re: open link with external program from context menu

Unread post by Lew Rockwell Fan » 2017-10-11, 01:13

I think I chose a poor thread title. People are thinking of "opening" a link as meaning in a browser, and I'm talking about using the link (or in the best case, anything you can right click on) as the entering argument for ANY kind of external program.

Anyway, if anyone finds this thread because they are trying to do something similar:

SOLVED

First, anyone with similar objectives might want to test the more straight forward solutions of "Open With" and "Menu Wizard". They don't work for me, but systems differ. Secondly if it has been very long since this post (2017 oct 10) things may have changed and you might want to look for new extensions.

But, if that doesn't work, what I settled on is similar to what I tried earlier monitoring the the clipboard content with a loop in a script, but instead monitoring changes in the clipboard with a program called Copyq. It's lighter, more predictable, and more flexible than looping through repeated checks of the clipboard. I did this in a linux, using bash, so details will vary in other circumstances, but Copyq is cross platform & you could certainly use some other scripting language or even do everything inside Copyq.

Set Copyq to call the program or a wrapper script every time the clipboard changes or every time the change meets specified criteria set in configuring the action in Copyq, like a regex or what kind of window it was copied from. Then you just right click and copy whatever. If your external program is a binary, you'll send it the content of either the primary selection or the clipboard as an argument in the invocation from Copyq. If it is a script, you can just use a variable in it like `$(xclip -o)` instead of something like $1 or $@. If whatever you copy meets your conditions for action your script does whatever you want with what you copied, otherwise, it exits silently and it is no different than a regular copy operation. If the action you want to take is something that you won't want to do EVERY time you copy that kind of thing and when-do/when-don't can't be scripted, you'll have to have one extra step that could be avoided with the "add an item to the context menu" approach - a yes/no dialogue that could be done with something like Zenity.

If the criteria for whether or not you'd want the item copied to be acted upon as a variable within or argument to an external program CAN be scripted, then then you don't even need the yes/no and the only effective difference between this and getting it into the context menu is the menu won't have a mnemonic entry and you'll overwrite whatever was in the clipboard and/or the primary selection.

I should also point out that the external program can be a menu, so that copy (including but not limited to "copy link") acquires a hidden submenu that appears whenever what you are copying meets your criteria. This approach works for anything you can copy, not just links.

And there are some bonuses to this approach. The result isn't limited to Pale Moon. You can have the same program react the same way to anything you copy in any programs you like. You can set it up to be active in any kind of windows you want it to be active in, so, for instance, if you want bits of text copied from leafpad to be checked automatically but not if they came from geany, no problem. And you get one heck of clipboard manager that won't interfere with the normal function of xclip at all.

Lew Rockwell Fan

Re: open link with external program from context menu

Unread post by Lew Rockwell Fan » 2018-03-13, 19:44

Lew Rockwell Fan wrote:There are Ffx addons that purport to do this. I've tried them all. . . . So I'm going to purge Pale Moon, reinstall, and try again. . . .
it would be nice to know if anyone has had success with any approach to getting an "open with ____" item added to the context menu . . .
Anybody here been able to make something like that work?
Lew Rockwell Fan wrote:The heart of the question is:

Has anybody here, "using PM under a linux had success with some particular approach"?
Update: Finally, the eleventy-seventh time's the charm.
Fresh install of PM 27.8.1 under a new system, very similar to the old one, also made from the Ubuntu 16.04 mini.iso with X and Openbox, no DE, & I can now answer the question:

Yes. I have.

Not sure which change made the difference:

- changes in the OS (Using a DM this time instead of startx. I reinstalled from scratch partly because I was having trouble with sound - & now it works fine, so something significant has changed. The package list is similar but not identical.

- the newer version of PM

- I installed "Open With" before any other extensions apart from Tab Kit. Those are the only 2 extensions I have at the moment. This is what I'd bet on. If I break it with another extension, I'll update this.

Now "Open With" works just like it is supposed to. I have it set to offer 3 other PM profiles, FireFox, and a script as choices on the context menu for links and in the View menu for the link to the current page. The script is just a proof of concept, popping up gxmessage and confirming that "$1" is indeed the url. Just for links, but, as the title indicated, that was the important goal, the other stuff was just incidental gravy if possible. Highlighted text is easy enough to deal with in a separate approach not requiring an extension (at least in Openbox, don't know about other WMs).

Locked