klaudio 0.11.4 → 0.12.0

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/notify.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "klaudio",
3
- "version": "0.11.4",
3
+ "version": "0.12.0",
4
4
  "description": "Add sound effects to your coding sessions — play sounds when tasks complete, notifications arrive, and more",
5
5
  "type": "module",
6
6
  "bin": {
package/src/notify.js CHANGED
@@ -65,6 +65,7 @@ function notifyWindows(title, body) {
65
65
  const toastXml = `<toast${toastAttrs}><visual><binding template="ToastGeneric"><text>${safeTitle}</text><text>${safeBody}</text></binding></visual></toast>`;
66
66
 
67
67
  // PowerShell script: show WinRT toast notification
68
+ // Use -EncodedCommand to avoid all escaping issues with special chars
68
69
  const ps = `\
69
70
  [void][Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
70
71
  [void][Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom, ContentType = WindowsRuntime]
@@ -73,8 +74,8 @@ $x.LoadXml('${toastXml.replace(/'/g, "''")}')
73
74
  $t = [Windows.UI.Notifications.ToastNotification]::new($x)
74
75
  [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${appId}').Show($t)`;
75
76
 
76
- // Run detached so the Node process can exit immediately
77
- const child = spawn("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", ps], {
77
+ const encoded = Buffer.from(ps, "utf16le").toString("base64");
78
+ const child = spawn("powershell.exe", ["-NoProfile", "-NonInteractive", "-EncodedCommand", encoded], {
78
79
  windowsHide: true,
79
80
  detached: true,
80
81
  stdio: "ignore",