The `windows.toast_notification()` function is not working properly.
What Operating System(s) are you seeing this problem on?
Windows
Which Wayland compositor or X11 Window manager(s) are you using?
winver: 19045.3803
WezTerm version
wezterm 20240203-110809-5046fc22
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
I started the Lua debugging layer using Ctrl+Shift+L, and then I entered
> win = wezterm.gui.gui_windows()[1]
> print(win)
13:50:49.642 INFO logging > lua: GuiWin(mux_window_id:0, pid:4532)
> win:toast_notification('wezterm', 'hello world!', nil, 4000)
but no toast notification is being displayed.
To Reproduce
No response
Configuration
return {}
Expected Behavior
I would like to see a notification message in the status bar.
Logs
Debug Overlay wezterm version: 20240203-110809-5046fc22 x86_64-pc-windows-msvc Window Environment: Windows Lua Version: Lua 5.4 OpenGL: Intel(R) UHD Graphics 630 4.5.0 - Build 31.0.101.2115 Enter lua statements or expressions and hit Enter. Press ESC or CTRL-D to exit
win = wezterm.gui.gui_windows()[1] print(win) 13:50:49.642 INFO logging > lua: GuiWin(mux_window_id:0, pid:4532) win:toast_notification('wezterm', 'hello world!', nil, 4000)
Anything else?
I installed WezTerm using Scoop.
Same here, window:toast_notification doesn't seem to do anything for me?
I think this has something to do with the installation method.
On Windows, notifications work when installed with winget (i.e. using the installer as non-portable), while with scoop (as a portable install) not notifications show. I tested this the same way as @leetking, can someone else confirm this?
I too use scoop and toast notifications do not work. I'll try installing the non portable version and testing. EDIT: toasts work when using wezterm installed via the setup.exe
I did some tests as follows:
- The wezterm installed by scoop actually downloads the non-portable installation package from the release page https://github.com/wez/wezterm/releases/download/20240203-110809-5046fc22/WezTerm-windows-20240203-110809-5046fc22.zip , so after I manually downloaded the portable zip, decompressed it and used it, I found that notification could not be triggered either.
- After downloading setup.exe and installing it, click on the newly installed wezterm-gui.exe. The experiment found that notification can be triggered.
- Interestingly, I also opened wezterm-gui.exe installed by scoop and found that nofication can also be triggered.
- Uninstall the wezterm installed through setup.exe and reopen the wezterm installed by scoop. Nofication cannot be triggered.
Presumption: The setup.exe installation will register some information in the system, but the scoop or downloaded portable version lacks this information, resulting in the failure to trigger the notification.
- The wezterm installed by scoop actually downloads the non-portable installation package from the release page ...
Scoop packages usually extract the contents .exe, so the bundled installer is not run. From looking at the manifest, this seems to be the case. Although I do not really know any technical details on what that means.
- Interestingly, I also opened wezterm-gui.exe installed by scoop and found that nofication can also be triggered.
I can confirm this, probably because the installer does something® that makes the notification possible irrespective of the installation path.
The setup.exe installation will register some information in the system, but the scoop or downloaded portable version lacks this information, resulting in the failure to trigger the notification.
My first guess would be a registry key, scoop does not automatically edit the registry by default.
https://learn.microsoft.com/en-us/answers/questions/159295/no-desktop-notifications-for-portable-apps-from-ne According to this article, it seems to be a common problem with portable programs. According to the answer of Eleven Yu:
The notifications settings can be deployed by GPO or registry. Group Policy: Computer Configuration\Administrative Templates\Windows Components\App Privacy - Let Windows apps access notifications Registry: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\AppPrivacy
I need to register a GPO, but I don’t know much about it.
According to my understanding: Wezterm's setup.exe is generated by inno setup. After it is installed, it appears as an application on the Windows system. The installed program can be found in Notifications & actions, so you can control whether notifications are allowed to be issued. , but the portable program does not appear as an application to windows.