aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Cox <me@jasoncarloscox.com>2024-02-22 20:25:22 -0500
committerRobin Jarry <robin@jarry.cc>2024-04-13 21:46:47 +0200
commit771e676953c54aa6c818020687b53470ec5597f3 (patch)
treec8c9d308efaacc5691af699f904fc05c56815d7f
parent480637d9ed8cf979f4be377cb37fdd14b60ceef3 (diff)
downloadaerc-771e676953c54aa6c818020687b53470ec5597f3.tar.gz
aerc-771e676953c54aa6c818020687b53470ec5597f3.zip
ipc: add more fine-grained options to disable IPC
Add disable-ipc-mailto and disable-ipc-mbox to make mailto:... and mbox:... commands always run in a new instance, while still allowing aerc-internal commands (i.e., aerc :<command...>) to run over IPC. Changelog-added: Add config options `disable-ipc-mailto` and `disable-ipc-mbox` to make `mailto:...` and `mbox:...` commands always run in a new aerc instance. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--config/aerc.conf12
-rw-r--r--config/general.go2
-rw-r--r--doc/aerc-config.5.scd12
-rw-r--r--main.go5
4 files changed, 30 insertions, 1 deletions
diff --git a/config/aerc.conf b/config/aerc.conf
index 70f07949..5fa1e6f1 100644
--- a/config/aerc.conf
+++ b/config/aerc.conf
@@ -45,6 +45,18 @@
# Default: false
#disable-ipc=false
+# Don't run mailto:... commands over IPC; start a new aerc instance with the
+# composer instead.
+#
+# Default: false
+#disable-ipc-mailto=false
+#
+# Don't run mbox:... commands over IPC; start a new aerc instance with the mbox
+# file instead.
+#
+# Default: false
+#disable-ipc-mbox=false
+
# Set the $TERM environment variable used for the embedded terminal.
#
# Default: xterm-256color
diff --git a/config/general.go b/config/general.go
index 6dc674b0..6fd37dcf 100644
--- a/config/general.go
+++ b/config/general.go
@@ -17,6 +17,8 @@ type GeneralConfig struct {
LogFile string `ini:"log-file"`
LogLevel log.LogLevel `ini:"log-level" default:"info" parse:"ParseLogLevel"`
DisableIPC bool `ini:"disable-ipc"`
+ DisableIPCMailto bool `ini:"disable-ipc-mailto"`
+ DisableIPCMbox bool `ini:"disable-ipc-mbox"`
EnableOSC8 bool `ini:"enable-osc8" default:"false"`
Term string `ini:"term" default:"xterm-256color"`
DefaultMenuCmd string `ini:"default-menu-cmd"`
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index fae2abc2..d457e0ab 100644
--- a/doc/aerc-config.5.scd
+++ b/doc/aerc-config.5.scd
@@ -70,6 +70,18 @@ These options are configured in the *[general]* section of _aerc.conf_.
Default: _false_
+*disable-ipc-mailto* = _true_ | _false_
+ Don't run _mailto:..._ commands over IPC; start a new aerc instance with the
+ composer instead.
+
+ Default: _false_
+
+*disable-ipc-mbox* = _true_ | _false_
+ Don't run _mbox:..._ commands over IPC; start a new aerc instance with the
+ mbox file instead.
+
+ Default: _false_
+
*term* = _<TERM>_
Set the $TERM environment variable used for the embedded terminal.
diff --git a/main.go b/main.go
index b7437fbd..21805345 100644
--- a/main.go
+++ b/main.go
@@ -171,7 +171,10 @@ func main() {
noIPC := opts.NoIPC || config.General.DisableIPC
- if len(opts.Command) > 0 && !noIPC {
+ if len(opts.Command) > 0 && !noIPC &&
+ !(config.General.DisableIPCMailto && strings.HasPrefix(opts.Command[0], "mailto:")) &&
+ !(config.General.DisableIPCMbox && strings.HasPrefix(opts.Command[0], "mbox:")) {
+
response, err := ipc.ConnectAndExec(opts.Command)
if err == nil {
if response.Error != "" {