Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Toast shows PowerShell #219

Open
D3XX3R opened this issue May 29, 2024 · 2 comments
Open

Windows Toast shows PowerShell #219

D3XX3R opened this issue May 29, 2024 · 2 comments

Comments

@D3XX3R
Copy link

D3XX3R commented May 29, 2024

Using notify-rust on Windows shows that the toast comes from Windows PowerShell.
I've tried using appname but that doesn't seem to do anything.

Is there a way to use a custom application name for the toasts on Windows?

@kareemmahlees
Copy link

I just noticed the same thing.

I took a look at the code and found out that it's passing app_id ( not appname ) to the underlying winrt_notification, if app_id is not set it defaults to powershel's app id, does setting app_id instead solves your problem? ( here is how you find the App User Model ID for your app )

Note

Please take a look at the below from winrt_notification docs:

If the program you are using this in was not installed, use Toast::POWERSHELL_APP_ID for now.

@rctlmk
Copy link

rctlmk commented Sep 1, 2024

I was playing around with Tauri's winrt-notification and I was able to set a custom name and icon for the notification. All you need to do is create a new key in HKEY_CLASSES_ROOT\AppUserModelId with your AUMID and use it when creating a notification.
The example below uses one of the IDs that I already had on my PC:
image
Exported reg key:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AppUserModelId\FirefoxToast-CA9422711AE1A81C]
;COM activator, optional
"CustomActivator"="{B93735BB-724D-4F0B-A9BB-6584C2819E68}"
"DisplayName"="Mozilla Firefox"
"IconBackgroundColor"="0"
"IconUri"="C:\Program Files\Mozilla Firefox\browser\VisualElements\VisualElements_70.png"

Code snippet:

use tauri_winrt_notification::Sound;
use tauri_winrt_notification::Toast;

Toast::new("FirefoxToast-CA9422711AE1A81C")
    .title("Look at this flip!")
    .text1("(╯°□°)╯︵ ┻━┻")
    .add_button("OK", "ok")
    .sound(Some(Sound::Default))
    .show()
    .expect("unable to toast");

https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/send-local-toast-other-apps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants