0

我正在使用 jetpack compose 开发一个桌面应用程序,它大量使用 windows toast 通知功能。我使用 PowerShell 脚本通过BurntToast模块推送 toast 通知。通知工作正常,但每次执行时,我都会将 Windows Powershell 视为应用程序名称,而不是任何自定义名称。

PowerShell 通知图像:

PowerShell 通知图像

如何将名称从 Windows PowerShell 更改为我想要的名称?

# First, create all the component pieces

$AppLogo = New-BTImage -Source 'C:\Demos\img.jpg' -AppLogoOverride -Crop Circle
$HeroImage = New-BTImage -Source 'https://c.tenor.com/XfrqyR_-jzIAAAAC/anime-goku.gif' -HeroImage
$MapImage = New-BTImage -Source 'https://media.giphy.com/media/WW33vGSPHXym7Wh80e/giphy.gif'

$TextHeading = New-BTText -Text 'Lord Shiva'
$TextBody = New-BTText -Text 'The mightiest god there is!'

# Then bind them together

$Binding = New-BTBinding -Children $TextHeading, $TextBody, $MapImage -AppLogoOverride $AppLogo -HeroImage $HeroImage

# And remember that these components are visual, but not actionable

$Visual = New-BTVisual -BindingGeneric $Binding

# Speaking of actionable, we're using actions right?

$GoogleButton = New-BTButton -Content 'Google Maps' -Arguments 'https://www.google.com/maps/SNIP'
$BingButton = New-BTButton -Content 'Bing Maps' -Arguments 'https://www.bing.com/maps?SNIP'

# Don't forget that an action by itself is useless, even a single button needs to become plural

$Actions = New-BTAction -Buttons $GoogleButton, $BingButton

# Now all of the content is together...

$Content = New-BTContent -Visual $Visual -Actions $Actions

# We can submit it to the Operating System

Submit-BTNotification -Content $Content
4

0 回答 0