diff options
author | Moritz Poldrack <git@moritz.sh> | 2023-03-15 22:40:38 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-04-01 01:01:09 +0200 |
commit | f10b184eb34634b9642fa83ef0f1cd8d0687a4af (patch) | |
tree | 8806be0073294a1d6542fa0447d8fee8e12230e5 /main.go | |
parent | 2fef0f4a60c8026c156ad8d75078bccde6a540d8 (diff) | |
download | aerc-f10b184eb34634b9642fa83ef0f1cd8d0687a4af.tar.gz |
hooks: add aerc-startup hook
Add a hook to run when aerc starts up. The environment is supplemented
with aerc version and the path to its binary.
References: https://todo.sr.ht/~rjarry/aerc/136
References: https://todo.sr.ht/~rjarry/aerc/139
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -23,6 +23,7 @@ import ( "git.sr.ht/~rjarry/aerc/commands/terminal" "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib/crypto" + "git.sr.ht/~rjarry/aerc/lib/hooks" "git.sr.ht/~rjarry/aerc/lib/ipc" "git.sr.ht/~rjarry/aerc/lib/templates" libui "git.sr.ht/~rjarry/aerc/lib/ui" @@ -242,6 +243,14 @@ func main() { } ui.ChannelEvents() + go func() { + defer log.PanicHandler() + err := hooks.RunHook(&hooks.AercStartup{Version: Version}) + if err != nil { + msg := fmt.Sprintf("aerc-startup hook: %s", err) + aerc.PushError(msg) + } + }() for event := range libui.MsgChannel { switch event := event.(type) { case tcell.Event: |