Skip to content

Commit f5ad57b

Browse files
author
Your Name
committed
fix: Break long PowerShell command for Windows notifications
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
1 parent ab7734d commit f5ad57b

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

cecli/io.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,16 +1708,23 @@ def get_default_notification_command(self):
17081708
return None # No known notification tool found
17091709
elif system == "Windows":
17101710
# PowerShell toast notification
1711-
return (
1712-
"powershell -command"
1713-
f' "try {{ Add-Type -AssemblyName System.Runtime.WindowsRuntime; $null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] }} catch {{}}; '
1714-
f"$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02); "
1715-
f"$toastXml = $template.GetXml(); "
1716-
f"$toastXml.GetElementsByTagName('text')[0].AppendChild($template.CreateTextNode('cecli')) > $null; "
1717-
f"$toastXml.GetElementsByTagName('text')[1].AppendChild($template.CreateTextNode('{NOTIFICATION_MESSAGE}')) > $null; "
1718-
f"$toast = [Windows.UI.Notifications.ToastNotification]::new($toastXml); "
1719-
f"[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('cecli').Show($toast)\""
1711+
ps_command = (
1712+
' "try {{ Add-Type -AssemblyName System.Runtime.WindowsRuntime; $null ='
1713+
" [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications,"
1714+
" ContentType = WindowsRuntime] }} catch {{}}; "
1715+
"$template ="
1716+
" [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent"
1717+
"([Windows.UI.Notifications.ToastTemplateType]::ToastText02); "
1718+
"$toastXml = $template.GetXml(); "
1719+
"$toastXml.GetElementsByTagName('text')[0].AppendChild"
1720+
"($template.CreateTextNode('cecli')) > $null; "
1721+
f"$toastXml.GetElementsByTagName('text')[1].AppendChild"
1722+
f"($template.CreateTextNode('{NOTIFICATION_MESSAGE}')) > $null; "
1723+
"$toast = [Windows.UI.Notifications.ToastNotification]::new($toastXml); "
1724+
"[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('cecli')"
1725+
'.Show($toast)"'
17201726
)
1727+
return "powershell -command" + ps_command
17211728

17221729
return None # Unknown system
17231730

0 commit comments

Comments
 (0)