nixos/modules/home/opencode/plugin/notify.ts

16 lines
467 B
TypeScript

export default async ({ $ }) => {
const notify = (summary, body) => {
$`notify-send -a opencode ${summary} ${body}`.quiet().nothrow().catch(() => {})
}
return {
event: async ({ event }) => {
if (event.type === "permission.updated") {
notify("opencode needs input", event.properties.title ?? event.properties.type)
} else if (event.type === "session.idle") {
notify("opencode finished", "Agent is idle")
}
},
}
}