Skip to content

switch from terminal-notifier to alerter#76

Open
mkozjak wants to merge 1 commit into
gen2brain:masterfrom
mkozjak:feat/macos-alerter
Open

switch from terminal-notifier to alerter#76
mkozjak wants to merge 1 commit into
gen2brain:masterfrom
mkozjak:feat/macos-alerter

Conversation

@mkozjak
Copy link
Copy Markdown

@mkozjak mkozjak commented May 15, 2026

This PR aims on switching from terminal-notifier to Alerter with the change being fully transparent to users.

While there are not many changes in program arguments on alerter (aside from the single to double dash change) there's a distinct change in Alerter that makes the process hang until the notification quits. This renders our c.Run() golang call to Wait indefinitely and makes the command change to not be transparent to library users. Hence why alerter is now launched with Start() instead of Run(), so the library returns to the caller without blocking for the lifetime of the notification.

The main issue with letting the process launch on its own without any checkups is the existing app icon cleanup procedure, that erases the photo before the alerter process settles and starts idling with its notification drawn on the screen.

With the aid from AI there's two new private functions, pidTaskInfo and waitUntilIdle, that use low-level C functions to determine the alerter process is actually ready before returning.

More background on this here.

Resolves #75.
We can also consider this PR just as a PoC. I can convert it to draft if needed.

This PR builds and runs successfully on my macOS Tahoe 26.5 setup.

My testing code:

package main

import (
	_ "embed"

	"github.com/gen2brain/beeep"
)

//go:embed info.png
var icon []byte

func main() {
	err := beeep.Notify("Title", "Message body", icon)
	if err != nil {
		panic(err)
	}

}
scr

@mkozjak
Copy link
Copy Markdown
Author

mkozjak commented May 21, 2026

@gen2brain - any thoughts on this approach?

@gen2brain
Copy link
Copy Markdown
Owner

Did not have much time to test; I have some VMs I am using for that. I do not like all that additional code and am not convinced it is needed, so I have to check for myself when I find the time.

@mkozjak
Copy link
Copy Markdown
Author

mkozjak commented May 21, 2026

Yes, I totally agree. I guess it's best for vjeantet/alerter#70 to get resolved first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch to Alerter for macOS

2 participants