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.
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
#
# {} 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=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)
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.