gen2brain / beeep

Go cross-platform library for sending desktop notifications, alerts and beeps
BSD 2-Clause "Simplified" License
1.43k stars 89 forks source link

Windows 11 support? #51

Open eXpansiiVe opened 1 year ago

eXpansiiVe commented 1 year ago

Anyone knows if this package works with windows 11 aswell? Because i'm trying to implent it in my application but it doesn't send any system notification, i managed to make work only the beeep.Beep() .

pztrn commented 1 year ago

Looks like it is simply an addition of another comparison to https://github.com/gen2brain/beeep/blob/master/notify_windows.go#L35.

gen2brain commented 1 year ago

I guess it should not be difficult to add support, if everything else is the same. I don't have Win11 system to try currently, so it can take some time, any help is welcome.

eXpansiiVe commented 1 year ago

Looks like it is simply an addition of another comparison to https://github.com/gen2brain/beeep/blob/master/notify_windows.go#L35.

I don't think that's the problem, because the value of CurrentMajorVersionNumber in the windows 11 registry is the same as the value on windows 10. I'm currently on Windows 11. CurrentMajorVersionNumber

Threnklyn commented 1 year ago

looks like github.com/go-toast/toast is not working with windows 11 I tried to run the exe and nothing happened

quite commented 1 year ago

It works for me on my installation of windows 11 home. Also beeep uses the correct toastNotify method.

henhouse commented 1 year ago

If anyone is interested, I took a look into this and from what I can ascertain the Powershell script that is generated to conduct the toast notification on Windows no longer works in Windows 11. There are no errors returned from Powershell itself, but no notifications occur.

I am assuming Windows 11 reworked the system somehow and it is no longer possible? To double check this theory, I followed a guide using a slightly different method to create notifications and seemingly nothing happened there, either.

I also asked ChatGPT for help as well on generating toast notifications with PS in Windows 11 to see if it could provide useful solutions, and it said "Unfortunately, in Windows 11, without relying on third-party tools, packages, or modules, there is no built-in way to display toast notifications using vanilla PowerShell.". No source on that, so take it with a grain of salt if it's correct, but it would corroborate the theory, if true.

As mentioned earlier, the registry key does identify itself as "10" in Win11, so something like the build version key would be better to target in the future (Windows 11 builds begin at 22000). But this makes no difference until an alternate method to generate notifications is solved, unfortunately.

Arno500 commented 1 year ago

There is apparently a way: https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/send-local-toast-other-apps It requires quite a lot of work though, but it should be flexible and allow to use actions and items inside the "app notification" (as they call them)