mirror of
https://github.com/don-philipe/dotfiles.git
synced 2026-06-10 00:43:14 +02:00
Add opencode notifications
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { Plugin } from "@opencode-ai/plugin";
|
||||
|
||||
export const NotifySendPlugin: Plugin = async ({ $ }) => {
|
||||
const mainSessions = new Set<string>();
|
||||
const notify = async (summary: string, body: string) => {
|
||||
try {
|
||||
await $`notify-send -i ~/.config/opencode/plugin/opencode-logo-dark.svg ${summary} ${body}`;
|
||||
} catch { }
|
||||
};
|
||||
|
||||
return {
|
||||
event: async ({ event }) => {
|
||||
switch (event.type) {
|
||||
case "session.created":
|
||||
const session = event.properties.info;
|
||||
if (!session.parentID) {
|
||||
mainSessions.add(session.id);
|
||||
}
|
||||
break;
|
||||
case "session.deleted":
|
||||
mainSessions.delete(event.properties.info.id);
|
||||
break;
|
||||
case "session.status":
|
||||
const { sessionID, status } = event.properties;
|
||||
if (status.type === "idle" && mainSessions.has(sessionID)) {
|
||||
await notify("OpenCode", "Session status updated");
|
||||
}
|
||||
break;
|
||||
case "question.asked":
|
||||
await notify("OpenCode", "Question asked");
|
||||
break;
|
||||
case "permission.asked":
|
||||
await notify("OpenCode", "Permission requested");
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
<svg width='240' height='300' viewBox='0 0 240 300' fill='none' xmlns='http://www.w3.org/2000/svg'><g clip-path='url(#clip0_1401_86283)'><mask id='mask0_1401_86283' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='240' height='300'><path d='M240 0H0V300H240V0Z' fill='white'/></mask><g mask='url(#mask0_1401_86283)'><path d='M180 240H60V120H180V240Z' fill='#4B4646'/><path d='M180 60H60V240H180V60ZM240 300H0V0H240V300Z' fill='#F1ECEC'/></g></g><defs><clipPath id='clip0_1401_86283'><rect width='240' height='300' fill='white'/></clipPath></defs></svg>
|
||||
|
After Width: | Height: | Size: 577 B |
Reference in New Issue
Block a user