Easy way to register Notification App (Name and Icon)
Easy way to register Notification App (Name and Icon)
I figured there had to be an easy way to register an application via code with PowerShell 5.1 to display a custom toast notification name/icon for BurntToast. The function below will register the filled in details into the registry under the "HKCU:\Software\Classes\AppUserModelId", but as long as the machine is not locked down, the entry also gets added into "HKCR\AppUserModelId" which makes this all possible (From what I can see).
Once you have registered your "app", simply plug in the specified app name into BurntToast and enjoy!
From many other users, this seems to work on Windows 10/11 just fine 😊
Function - Register Notification App:
Function Register-NotificationApp {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
$AppID,
[Parameter(Mandatory=$true)]
$AppDisplayName,
[Parameter(Mandatory=$false)]
[int]$ShowInSettings=0,
[Parameter(Mandatory=$false)]
$IconPath
)
$CurrentUserRegPath = "HKCU:\Software\Classes\AppUserModelId"
If (!(Test-Path $CurrentUserRegPath)) {
New-Item -Path $CurrentUserRegPath -Force
}
$RegPath = Join-Path -Path $CurrentUserRegPath -ChildPath $AppID
If (!(Test-Path $RegPath)) {
$null = New-Item -Path $CurrentUserRegPath -Name $AppID -Force
}
$DisplayName = (Get-ItemProperty -Path $RegPath -Name DisplayName -ErrorAction SilentlyContinue).DisplayName
If ($DisplayName -ne $AppDisplayName) {
$null = New-ItemProperty -Path $RegPath -Name DisplayName -Value $AppDisplayName -PropertyType String -Force
}
$ShowInSettingsValue = (Get-ItemProperty -Path $RegPath -Name ShowInSettings -ErrorAction SilentlyContinue).ShowInSettings
If ($ShowInSettingsValue -ne $ShowInSettings) {
$null = New-ItemProperty -Path $RegPath -Name ShowInSettings -Value $ShowInSettings -PropertyType DWORD -Force
}
If ($IconPath -and (Test-Path $IconPath -PathType Leaf)) {
$null = New-ItemProperty -Path $RegPath -Name IconUri -Value $IconPath -PropertyType String -Force
}
}
Usage Example:
Register-NotificationApp -AppID "AppCompany.AppName!App" -AppDisplayName "Sample Application Name" -IconPath "C:\SampleIcon.ico"
Screenshot Example:
Archetype Counter is a PowerShell script (https://github.com/ssjshields/archetype-counter)
Thanks for sharing. Still works. Similar to https://gist.github.com/NickolajA/3604ba1a704bf7319cd4fb5779d06a89.
But the showInSettings does not seem to do anything besides putting the entry into the registry.
Register-NotificationApp -AppID "Trallnag.Toast" -AppDisplayName "Trallnag Toast" -ShowInSettings 1
\
New-BurntToastNotification -AppId Trallnag.Toast -UniqueIdentifier 'Trallnag.Toast.1' -Text 'Test', 'Test'
Nevermind, it does show up in the settings:
Hello, and thank you for your contribution to BurntToast.
Today marks the official release of BurntToast v1.0.0. As part of this major milestone and to ensure the project starts its next chapter with a clean slate, I am declaring "issue bankruptcy."
This decision is explained in more detail in the official announcement post: Ten Years Toasting: BurntToast Hits the Big v1!
As a result, I am closing all outstanding issues and pull requests, including this one. Please do not interpret this as a lack of interest in the problem or suggestion you've raised. This is a necessary step to clear a very old backlog and focus development efforts on the current state of the module.
If this topic is still relevant to you:
- Please update to the latest version of BurntToast (
v1.0.0or newer). - Verify that your issue still exists in the new version.
- If it does, please open a new issue. You are welcome to link back to this one for historical context.
I hope this reset will allow me to be more responsive to community feedback going forward.
Thank you for your understanding and for being part of the BurntToast journey.