From 690875fb21110106f3e0765458194e4717a3cba4 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lopes" Date: Thu, 19 Feb 2026 20:22:38 +0000 Subject: [PATCH] add alacritty and pi --- alacritty/config.lua | 6 ++ pi/config.lua | 6 ++ pi/files/agent/extensions/pi-done-notify.ts | 82 +++++++++++++++++++++ pi/files/agent/settings.json | 7 ++ 4 files changed, 101 insertions(+) create mode 100644 alacritty/config.lua create mode 100644 pi/config.lua create mode 100644 pi/files/agent/extensions/pi-done-notify.ts create mode 100644 pi/files/agent/settings.json diff --git a/alacritty/config.lua b/alacritty/config.lua new file mode 100644 index 0000000..9a932b4 --- /dev/null +++ b/alacritty/config.lua @@ -0,0 +1,6 @@ +return { + target = { + linux = "~/.config/alacritty", + default = "~/.config/alacritty", + }, +} diff --git a/pi/config.lua b/pi/config.lua new file mode 100644 index 0000000..7b127de --- /dev/null +++ b/pi/config.lua @@ -0,0 +1,6 @@ +return { + target = { + linux = "~/.pi", + default = "~/.pi", + }, +} diff --git a/pi/files/agent/extensions/pi-done-notify.ts b/pi/files/agent/extensions/pi-done-notify.ts new file mode 100644 index 0000000..15bc67a --- /dev/null +++ b/pi/files/agent/extensions/pi-done-notify.ts @@ -0,0 +1,82 @@ +/** + * Pi Done Notify Extension + * + * Sends a native terminal notification when Pi finishes a prompt + * and is waiting for input. + */ + +import type { ExtensionAPI } from "@mariozechner/pi-coding-agent"; + +function windowsToastScript(title: string, body: string): string { + const type = "Windows.UI.Notifications"; + const mgr = `[${type}.ToastNotificationManager, ${type}, ContentType = WindowsRuntime]`; + const template = `[${type}.ToastTemplateType]::ToastText01`; + const toast = `[${type}.ToastNotification]::new($xml)`; + return [ + `${mgr} > $null`, + `$xml = [${type}.ToastNotificationManager]::GetTemplateContent(${template})`, + `$xml.GetElementsByTagName('text')[0].AppendChild($xml.CreateTextNode('${body}')) > $null`, + `[${type}.ToastNotificationManager]::CreateToastNotifier('${title}').Show(${toast})`, + ].join("; "); +} + +function notifyOSC777(title: string, body: string): void { + process.stdout.write(`\x1b]777;notify;${title};${body}\x07`); +} + +function notifyOSC99(title: string, body: string): void { + process.stdout.write(`\x1b]99;i=1:d=1;${title}\x1b\\`); + process.stdout.write(`\x1b]99;i=1:p=body;${body}\x1b\\`); +} + +const DEFAULT_DURATION_MS = 5000; + +function notifyWindows(title: string, body: string): void { + const { execFile } = require("child_process"); + execFile("powershell.exe", [ + "-NoProfile", + "-Command", + windowsToastScript(title, body), + ]); +} + +function notifyDesktop( + title: string, + body: string, + iconPath: string, + durationMs = DEFAULT_DURATION_MS +): void { + const { execFile } = require("child_process"); + execFile( + "notify-send", + ["-t", `${durationMs}`, "-i", iconPath, title, body], + (error: Error | null) => { + if (error) { + notifyOSC777(title, body); + } + } + ); +} + +const ICON_PATH = "/home/thomasgl/.pi/agent/extensions/assets/pi-logo.svg"; + +function notify(title: string, body: string): void { + if (process.platform === "linux") { + notifyDesktop(title, body, ICON_PATH); + return; + } + if (process.env.WT_SESSION) { + notifyWindows(title, body); + } else if (process.env.KITTY_WINDOW_ID) { + notifyOSC99(title, body); + } else { + notifyOSC777(title, body); + } +} + +export default function (pi: ExtensionAPI) { + pi.on("agent_end", async (_event, ctx) => { + if (!ctx.hasUI) return; + notify("Pi", "Done. Ready for input."); + }); +} diff --git a/pi/files/agent/settings.json b/pi/files/agent/settings.json new file mode 100644 index 0000000..7122216 --- /dev/null +++ b/pi/files/agent/settings.json @@ -0,0 +1,7 @@ +{ + "lastChangelogVersion": "0.53.0", + "defaultProvider": "openrouter", + "defaultModel": "openai/gpt-5.2-codex", + "defaultThinkingLevel": "minimal", + "theme": "dark" +} \ No newline at end of file