~rjarry/aerc#64: 
:open, but with ability to specify handler?

With html parts, I like the w3m-style filtering for the terminal, but sometimes I'd like to view in a browser. When I do that, I prefer to use a dumber browser than my system browser, socksify it, and add the flags that disable scripts/caching/cookies/etc.

Am I overlooking a way to achieve this with the built-ins? If not, would you welcome a patch to add this feature?

Status
RESOLVED FIXED
Submitter
~bourgeois_bear
Assigned to
No-one
Submitted
1 year, 2 months ago
Updated
11 months ago
Labels
feature ui

~bourgeois_bear 1 year, 2 months ago

~bourgeois_bear 1 year, 2 months ago

ps> Doing this with :pipe, sh, & binds.conf at the moment, but it's kind of awkward. Would also be nice if pipe/exec could expand environment variables (or $HOME at least).

~rjarry 1 year, 1 month ago

What kind of option did you have in mind?

~bourgeois_bear 1 year, 1 month ago

Basically a riff on [filters], but for opening things. If not specified for a given mime type, revert to present xdg-open-style functionality. I think tempfiles would be better than piping for this particular feature, since a lot of programs don't have a simple way of pulling input from stdin (like browsers). That's some of the awkwardness of what I'm already doing--making a shell script just to snag stdin to a file & clean up afterward.

~bourgeois_bear 1 year, 1 month ago

And having printf-style substitutions available (at least full path to file [single vs. multiple like xdg .desktop spec]) would also be a plus, since with a few strange programs the last parameter isn't necessarily the input.

~bourgeois_bear 1 year, 1 month ago

And of course, carry whatever we do in the config file over to the :open command (probably has to be a new variation of it, since the original :open passed flags) for specifying the opener as well.

~q3cpma 1 year, 1 month ago

This ticket should also concern :open-link in some manner.

~bourgeois_bear 1 year, 6 days ago

@q3cpma :open-link is not in my man doc. Is that for opening URLs?

@rjarry: as far as implementation goes, I think something like .mailcap, but for openers instead of filters--specifying mime type, command, flags (like %s & %t in man 5 mailcap). Unspecified mime types revert to xdg-open. How does that sound?

~q3cpma referenced this from #64 1 year, 6 days ago

~q3cpma 1 year, 6 days ago

On Thu Sep 22, 2022 at 3:26 AM CEST, ~bourgeois_bear wrote:

@q3cpma :open-link is not in my man doc. Is that for opening URLs?

@rjarry: as far as implementation goes, I think something like .mailcap, but for openers instead of filters--specifying mime type, command, flags (like %s & %t in man 5 mailcap). Unspecified mime types revert to xdg-open. How does that sound?

-- View on the web: https://todo.sr.ht/~rjarry/aerc/64#event-206643

Yeah, it's missing from the main man page, but aerc-config(5) does mention it.

~rjarry 1 year, 6 days ago*

I may have misunderstood your need but it looks like you should use :open

https://git.sr.ht/~rjarry/aerc/tree/0.12.0/item/doc/aerc.1.scd#L390

  • Scratch that... I had fogotten that you already tried :open.

~bourgeois_bear 1 year, 6 days ago

@~q3cpma: re: open-link:

So if I have a open-overrides file in my aerc config dir with the following contents:

text/html; /path/to/preferred/browser %s

Both :open and :open-link could use that command, while if that file is missing, or exists without a text/html line, both will revert to xdg-open functionality. I believe in the average case, this would be the most convenient approach, but I'm almost certain someone will want different behavior between :open and :open-link, so ultimately, I think overriding the :open-link provider should be a one-liner in the primary config file, and have my open-overrides file only apply to :open.

~bourgeois_bear 1 year, 6 days ago

And come to think of it, a new command for specifying the opener on an as-needed basis. Something like:

:open-ex firefox %s

If classic :open weren't a direct flags pass, we could just add a flag to it for specifying the opener. But doing so at this point might break things for some people, so that's why I'm suggesting a new command.

~rjarry REPORTED FIXED 11 months ago

Robin Jarry referenced this ticket in commit 45bff88.

Register here or Log in to comment, or comment via email.