claude-code-notify-lite 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/notifier.js +20 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-notify-lite",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Task completion notifications for Claude Code - Cross-platform, lightweight, and easy to use",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/notifier.js CHANGED
@@ -15,40 +15,35 @@ function notifyWindows(title, message) {
15
15
  return new Promise((resolve) => {
16
16
  logger.info('Sending Windows notification', { title, messageLength: message.length });
17
17
 
18
- const escapedTitle = title.replace(/"/g, '\\"');
19
- const escapedMessage = message.replace(/"/g, '\\"').replace(/\n/g, '`n');
18
+ const escapedTitle = title.replace(/'/g, "''");
19
+ const escapedMessage = message.replace(/'/g, "''").replace(/\n/g, '`n');
20
20
 
21
21
  const psScript = `
22
- [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
23
- [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
24
- $template = @"
25
- <toast>
26
- <visual>
27
- <binding template="ToastText02">
28
- <text id="1">${escapedTitle}</text>
29
- <text id="2">${escapedMessage}</text>
30
- </binding>
31
- </visual>
32
- </toast>
33
- "@
34
- $xml = New-Object Windows.Data.Xml.Dom.XmlDocument
35
- $xml.LoadXml($template)
36
- $toast = [Windows.UI.Notifications.ToastNotification]::new($xml)
37
- [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("Claude Code").Show($toast)
38
- `.trim();
39
-
40
- exec(`powershell -NoProfile -ExecutionPolicy Bypass -Command "${psScript.replace(/"/g, '\\"')}"`,
22
+ Add-Type -AssemblyName System.Windows.Forms
23
+ $balloon = New-Object System.Windows.Forms.NotifyIcon
24
+ $balloon.Icon = [System.Drawing.SystemIcons]::Information
25
+ $balloon.BalloonTipIcon = 'Info'
26
+ $balloon.BalloonTipTitle = '${escapedTitle}'
27
+ $balloon.BalloonTipText = '${escapedMessage}'
28
+ $balloon.Visible = $true
29
+ $balloon.ShowBalloonTip(5000)
30
+ Start-Sleep -Seconds 5
31
+ $balloon.Dispose()
32
+ `;
33
+
34
+ const base64Command = Buffer.from(psScript, 'utf16le').toString('base64');
35
+
36
+ exec(`powershell -NoProfile -ExecutionPolicy Bypass -EncodedCommand ${base64Command}`,
41
37
  { encoding: 'utf8', windowsHide: true },
42
38
  (err) => {
43
39
  if (err) {
44
- logger.warn('Windows Toast failed, falling back to node-notifier', err);
40
+ logger.warn('Windows balloon notification failed, trying node-notifier', err);
45
41
  notifier.notify({
46
42
  title: title,
47
43
  message: message,
48
44
  sound: false,
49
45
  wait: false,
50
- timeout: 5,
51
- appID: 'Claude Code'
46
+ timeout: 5
52
47
  }, (notifyErr) => {
53
48
  if (notifyErr) {
54
49
  logger.error('node-notifier also failed', notifyErr);
@@ -58,7 +53,7 @@ function notifyWindows(title, message) {
58
53
  resolve();
59
54
  });
60
55
  } else {
61
- logger.info('Windows Toast notification sent successfully');
56
+ logger.info('Windows balloon notification sent successfully');
62
57
  resolve();
63
58
  }
64
59
  }