aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands/msgview/open.go5
-rw-r--r--doc/aerc.1.scd2
-rw-r--r--lib/open.go12
-rw-r--r--lib/open_darwin.go10
4 files changed, 25 insertions, 4 deletions
diff --git a/commands/msgview/open.go b/commands/msgview/open.go
index d1b3238..d25fa67 100644
--- a/commands/msgview/open.go
+++ b/commands/msgview/open.go
@@ -7,10 +7,10 @@ import (
"io/ioutil"
"mime/quotedprintable"
"os"
- "os/exec"
"strings"
"time"
+ "git.sr.ht/~sircmpwn/aerc/lib"
"git.sr.ht/~sircmpwn/aerc/widgets"
)
@@ -58,8 +58,7 @@ func (_ Open) Execute(aerc *widgets.Aerc, args []string) error {
return
}
- cmd := exec.Command("xdg-open", tmpFile.Name())
- err = cmd.Run()
+ err = lib.OpenFile(tmpFile.Name())
if err != nil {
aerc.PushError(" " + err.Error())
}
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index f97d01d..0b86f75 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -122,7 +122,7 @@ message list, the message in the message viewer, etc).
*open*
Saves the current message part in a temporary file and opens it
- with xdg-open.
+ with the system handler.
*pipe* <cmd>
Downloads and pipes the current message part into the given shell command,
diff --git a/lib/open.go b/lib/open.go
new file mode 100644
index 0000000..ad6533e
--- /dev/null
+++ b/lib/open.go
@@ -0,0 +1,12 @@
+// +build !darwin
+
+package lib
+
+import (
+ "os/exec"
+)
+
+func OpenFile(filename string) error {
+ cmd := exec.Command("xdg-open", filename)
+ return cmd.Run()
+}
diff --git a/lib/open_darwin.go b/lib/open_darwin.go
new file mode 100644
index 0000000..0ffd9a1
--- /dev/null
+++ b/lib/open_darwin.go
@@ -0,0 +1,10 @@
+package lib
+
+import (
+ "os/exec"
+)
+
+func OpenFile(filename string) error {
+ cmd := exec.Command("open", filename)
+ return cmd.Run()
+}