This should provide a way to configure link opener for users not having
xdg-open or similarly named script in the first place.
Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
---
CHANGELOG.md | 1 +config/aerc.conf | 3 ++-doc/aerc-config.5.scd | 7 ++++---lib/open.go | 2 +-
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cc22944..08023ae 100644
--- a/CHANGELOG.md+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
+- Configuration for `:open-link` via `[openers]` section in `aerc.conf`.- New column-based message list format with `index-columns`.
- Add a `msglist_answered` style for answered messages.
- Compose `Format=Flowed` messages with `format-flowed=true` in `aerc.conf`.
diff --git a/config/aerc.conf b/config/aerc.conf
index cb6e864..9a8c0d5 100644
--- a/config/aerc.conf+++ b/config/aerc.conf
@@ -488,13 +488,14 @@ message/rfc822=colorize
[openers]
#
# Openers allow you to specify the command to use for the :open action on a
-# per-MIME-type basis.+# per-MIME-type basis and for the :open-link command by using `open-link` key.#
# {} is expanded as the temporary filename to be opened. If it is not
# encountered in the command, the temporary filename will be appened to the end
# of the command.
#
# Examples:
+# open-link=firefox# text/html=surf -dfgms
# text/plain=gvim {} +125
# message/rfc822=thunderbird
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index 4d64a6f..b69f404 100644
--- a/doc/aerc-config.5.scd+++ b/doc/aerc-config.5.scd
@@ -803,9 +803,9 @@ customizations of the built-in filters.
# OPENERS
-Openers allow you to specify the command to use for the *:open* action on a-per-MIME-type basis. They are configured in the *[openers]* section of-_aerc.conf_.+Openers allow you to specify the command to use for the *:open* action on+a per-MIME-type basis and for *:open-link* with the open-link key. They are+configured in the *[openers]* section of _aerc.conf_._{}_ is expanded as the temporary filename to be opened. If it is not
encountered in the command, the temporary filename will be appened to the end
@@ -815,6 +815,7 @@ Example:
```
[openers]
+open-link=firefoxtext/html=surf -dfgms
text/plain=gvim {} +125
message/rfc822=thunderbird
diff --git a/lib/open.go b/lib/open.go
index 8477b8f..c25472e 100644
--- a/lib/open.go+++ b/lib/open.go
@@ -11,7 +11,7 @@ import (
)
func XDGOpen(uri string) error {
- return XDGOpenMime(uri, "", nil)+ return XDGOpenMime(uri, "open-link", nil)}
func XDGOpenMime(
--
2.39.2
On Wed Mar 8, 2023 at 12:22 PM PST, Kirill Chibisov wrote:
> This should provide a way to configure link opener for users not having> xdg-open or similarly named script in the first place.>> Signed-off-by: Kirill Chibisov <contact@kchibisov.com>> ---> CHANGELOG.md | 1 +> config/aerc.conf | 3 ++-> doc/aerc-config.5.scd | 7 ++++---> lib/open.go | 2 +-> 4 files changed, 8 insertions(+), 5 deletions(-)>> diff --git a/CHANGELOG.md b/CHANGELOG.md> index cc22944..08023ae 100644> --- a/CHANGELOG.md> +++ b/CHANGELOG.md> @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).> > ### Added> > +- Configuration for `:open-link` via `[openers]` section in `aerc.conf`.> - New column-based message list format with `index-columns`.> - Add a `msglist_answered` style for answered messages.> - Compose `Format=Flowed` messages with `format-flowed=true` in `aerc.conf`.> diff --git a/config/aerc.conf b/config/aerc.conf> index cb6e864..9a8c0d5 100644> --- a/config/aerc.conf> +++ b/config/aerc.conf> @@ -488,13 +488,14 @@ message/rfc822=colorize> [openers]> #> # Openers allow you to specify the command to use for the :open action on a> -# per-MIME-type basis.> +# per-MIME-type basis and for the :open-link command by using `open-link` key.
if my rationale below makes sense, i think this would be better phrased as
"... by using the `open-link` value."
> #> # {} is expanded as the temporary filename to be opened. If it is not> # encountered in the command, the temporary filename will be appened to the end> # of the command.> #> # Examples:> +# open-link=firefox> # text/html=surf -dfgms> # text/plain=gvim {} +125> # message/rfc822=thunderbird> diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd> index 4d64a6f..b69f404 100644> --- a/doc/aerc-config.5.scd> +++ b/doc/aerc-config.5.scd> @@ -803,9 +803,9 @@ customizations of the built-in filters.> > # OPENERS> > -Openers allow you to specify the command to use for the *:open* action on a> -per-MIME-type basis. They are configured in the *[openers]* section of> -_aerc.conf_.> +Openers allow you to specify the command to use for the *:open* action on> +a per-MIME-type basis and for *:open-link* with the open-link key. They are
i know Moritz was the one that gave advice in this case. forgive me if
this sounds pedantic, but is it a key, or a value?
ie the open-link=<...> config option is to hold a value presumably. in
this case the value is a string with the name of the program used to
open links. does that sound more accurate? in which case the phrasing
could be "...the `open-link` value...".
> +configured in the *[openers]* section of _aerc.conf_.> > _{}_ is expanded as the temporary filename to be opened. If it is not> encountered in the command, the temporary filename will be appened to the end> @@ -815,6 +815,7 @@ Example:> > ```> [openers]> +open-link=firefox> text/html=surf -dfgms> text/plain=gvim {} +125> message/rfc822=thunderbird> diff --git a/lib/open.go b/lib/open.go> index 8477b8f..c25472e 100644> --- a/lib/open.go> +++ b/lib/open.go> @@ -11,7 +11,7 @@ import (> )> > func XDGOpen(uri string) error {> - return XDGOpenMime(uri, "", nil)> + return XDGOpenMime(uri, "open-link", nil)> }> > func XDGOpenMime(> -- > 2.39.2
> +a per-MIME-type basis and for *:open-link* with the open-link key. They are
>> i know Moritz was the one that gave advice in this case. forgive me if> this sounds pedantic, but is it a key, or a value?>> ie the open-link=<...> config option is to hold a value presumably. in> this case the value is a string with the name of the program used to> open links. does that sound more accurate? in which case the phrasing> could be "...the `open-link` value...".>
The value though is the `firefox` in and the key is `open-link` in my example.
The section is `[openers]` which goes like
```
[openers]
key = value
```
Where the key is mime type/open-link and the value is the program to execute
for this key.
--
Kind Regards,
Kirill Chibisov
Hi Kirill,
thanks for your patch. I have a few remarks. Please see below:
Kirill Chibisov, Mar 08, 2023 at 21:22:
> This should provide a way to configure link opener for users not having> xdg-open or similarly named script in the first place.>> Signed-off-by: Kirill Chibisov <contact@kchibisov.com>> ---> CHANGELOG.md | 1 +> config/aerc.conf | 3 ++-> doc/aerc-config.5.scd | 7 ++++---> lib/open.go | 2 +-> 4 files changed, 8 insertions(+), 5 deletions(-)>> diff --git a/CHANGELOG.md b/CHANGELOG.md> index cc22944..08023ae 100644> --- a/CHANGELOG.md> +++ b/CHANGELOG.md> @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).> > ### Added> > +- Configuration for `:open-link` via `[openers]` section in `aerc.conf`.
These entries should usually be added at the end of the list unless you
have a good reason to add them on top.
> - New column-based message list format with `index-columns`.> - Add a `msglist_answered` style for answered messages.> - Compose `Format=Flowed` messages with `format-flowed=true` in `aerc.conf`.> diff --git a/config/aerc.conf b/config/aerc.conf> index cb6e864..9a8c0d5 100644> --- a/config/aerc.conf> +++ b/config/aerc.conf> @@ -488,13 +488,14 @@ message/rfc822=colorize> [openers]> #> # Openers allow you to specify the command to use for the :open action on a> -# per-MIME-type basis.> +# per-MIME-type basis and for the :open-link command by using `open-link` key.
This "open-link" MIME type feels a bit weird. It would be more natural
to use a generic URI MIME type such as "x-scheme-handler/*". The only
issue with that "/*" is that it may give the impression that wild cards
are supported so we need to make this explicit.
https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html#idm45530160413952> diff --git a/lib/open.go b/lib/open.go> index 8477b8f..c25472e 100644> --- a/lib/open.go> +++ b/lib/open.go> @@ -11,7 +11,7 @@ import (> )> > func XDGOpen(uri string) error {> - return XDGOpenMime(uri, "", nil)> + return XDGOpenMime(uri, "open-link", nil)
This will break calling XDGOpen("/path/to/file.foo") if you have an
"open-link" opener defined. I would prefer dropping that XDGOpen
function and replacing the calls by XDGOpenMIME with an explicit MIME
type.