diff --git a/README.md b/README.md index 60865a6..f8eb81b 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ Create `~/.config/opencode/opencode-notifier.json` with the defaults: "bell": false, "timeout": 5, "showProjectName": true, + "showFullPath": false, "showSessionTitle": false, "showIcon": true, "customIconPath": null, @@ -145,6 +146,7 @@ Create `~/.config/opencode/opencode-notifier.json` with the defaults: "bell": false, "timeout": 5, "showProjectName": true, + "showFullPath": false, "showSessionTitle": false, "showIcon": true, "suppressWhenFocused": true, @@ -158,6 +160,7 @@ Create `~/.config/opencode/opencode-notifier.json` with the defaults: - `bell` - Emit terminal BEL (`\x07`) on events (default: false). Behavior depends on your terminal/WM settings - `timeout` - How long notifications show in seconds, Linux only (default: 5) - `showProjectName` - Show folder name in notification title (default: true) +- `showFullPath` - Show full absolute path instead of folder name in notification title and `{projectName}` token (default: false). When true, shows `OpenCode (/home/user/projects/myapp)` instead of `OpenCode (myapp)` - `showSessionTitle` - Include the session title in notification messages via `{sessionTitle}` placeholder (default: false) - `showIcon` - Show OpenCode icon, Windows/Linux only (default: true) - `customIconPath` - Path to a custom icon for notifications. Useful on WSL where Windows paths are needed (default: null) diff --git a/bun.lock b/bun.lock index 27e3c0c..270a4be 100644 --- a/bun.lock +++ b/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "@mohak34/opencode-notifier", diff --git a/src/config.ts b/src/config.ts index 1e51564..7d9cec1 100644 --- a/src/config.ts +++ b/src/config.ts @@ -49,6 +49,7 @@ export interface NotifierConfig { bell: boolean timeout: number showProjectName: boolean + showFullPath: boolean showSessionTitle: boolean showIcon: boolean customIconPath: string | null @@ -125,6 +126,7 @@ const DEFAULT_CONFIG: NotifierConfig = { bell: false, timeout: 5, showProjectName: true, + showFullPath: false, showSessionTitle: false, showIcon: true, customIconPath: null, @@ -290,6 +292,7 @@ export function loadConfig(): NotifierConfig { ? userConfig.timeout : DEFAULT_CONFIG.timeout, showProjectName: userConfig.showProjectName ?? DEFAULT_CONFIG.showProjectName, + showFullPath: userConfig.showFullPath ?? DEFAULT_CONFIG.showFullPath, showSessionTitle: userConfig.showSessionTitle ?? DEFAULT_CONFIG.showSessionTitle, showIcon: userConfig.showIcon ?? DEFAULT_CONFIG.showIcon, customIconPath: userConfig.customIconPath ?? DEFAULT_CONFIG.customIconPath, diff --git a/src/index.ts b/src/index.ts index b535487..35818bb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -481,7 +481,7 @@ export const NotifierPlugin: Plugin = async ({ client, directory }) => { } const getConfig = () => loadConfig() - const projectName = directory ? basename(directory) : null + const projectName = directory ? (getConfig().showFullPath ? directory : basename(directory)) : null // Fire client_connected after the plugin is fully initialized. // There is no SDK event that reliably signals client connection from a plugin's