You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature request is to have the notification interface to allow the action center to receive notifications.
Reacted by Dovry, Ivan Soto Fernandez, Michael Keck, Nick Ribal, __init__, Matej Simek, Bryan, Moritz Andrich, Lukas Vanagas, Alan and 74 more
Reacted by Will, Fery Wardiyanto, bigbendrugs, Andreas Maier, Carlinhos de Sousa Junior, Zeeshan Equbal , Alex Vechkanov , Sajid Ali Mudassar, Simone Sestito, nokazn and 5 more
This means that the solution can probably already be accomplished by writing a Windows-land daemon that connects to the Linux-land D-Bus daemon over TCP, and creates Windows notification popups. I might even give this a go in C# if it's not too hard.
Unless the BoUoW team want to enable a way for the Linux D-Bus to be shared in another way (like allow Windows applications to consume a Unix pipe/socket, somehow...), and also build the notification client into the terminal, I'm not sure how much they can do.
Reacted by Sunil Muthuswamy, __init__, Anton Rudeshko, Milán Nagy, Ramana and enderozcan
Ryan Crosby (@crozone) - Interesting. I am just trying to visualize how this would work. So, the notify-send (or any other command) would go over libnotify to the WSL D-Bus service, which can publish the message over to the Desktop Notification Specification interface. And, if there is a Win32 Desktop Notification server that can consume these messages, then it can create the necessary popups?
The trick is that the win32 application can connect to the Linux D-Bus using a TCP connection to localhost. In theory, it would make the most sense for an X Window Sever (like XMing) to implement it on the win32 side, since IIRC it already establishes a connection to a D-Bus channel relating to that desktop. However, failing that, a stand alone application can work, but I'm not 100% sure how it would find the right D-Bus channel.
it would make the most sense for an X Window Sever (like XMing) to implement it on the win32 side
Wrong protocol. All the dbus action happens on the WSL side; an X Server (be it XMing, VcXsrv, native Linux Xorg) has no knowledge of dbus or what is being displayed in a popup window. It speaks X11 protocol.
The guys who obscure half their screen with Ubuntu wallpaper over in #637 already have desktop notifications. notify-send works fine for them; or at least, it should. I think you can fire up unity-notifications alone and get exactly what you describe (ignoring that unity-notifications probably falls on its face without Unity around). The xfce4 guys have something similar.
If all you want is CLI notify-send, actual Win32 Desktop Notifications, and no X11 to speak of, you could write your own Desktop Notification Specification service like Sunil describes. But the dbus session server and the notification client still live on the WSL side, communicating over an AF_UNIX socket. Typically you'd talk to the service using ssh.
Basically, on the Windows side you write an app that remote launches (on WSL) some Python script that sits there waiting for Desktop Notification Specification messages to arrive, and spits the notification text out to stdout in some formatted manner. Then on the windows side when new message text arrives over ssh you push a Windows Desktop notification.
Wrong protocol. All the dbus action happens on the WSL side; an X Server (be it XMing, VcXsrv, native Linux Xorg) has no knowledge of dbus or what is being displayed in a popup window. It speaks X11 protocol.
Ahh, thanks. I thought there was some magic there that would allow X apps to "find" the D-Bus channel for that session, but maybe that's something else.
Basically, on the Windows side you write an app that remote launches (on WSL) some Python script that sits there waiting for Desktop Notification Specification messages to arrive, and spits the notification text out to stdout in some formatted manner. Then on the windows side when new message text arrives over ssh you push a Windows Desktop notification.
I'm pretty sure you don't need to do this though, you can get D-Bus to listen for TCP connections, instead of just the AF_UNIX socket. This would let the Windows-land client speak to the Linux-land D-Bus, and therefore the the notification protocol, entirely natively.
Yeah I almost mentioned that but didn't want to yammer (knowing in my heart someone would bring it up anyway). That is technically correct, but would mean the mother-of-all dependency inversions. In other words, installing a hypothetical "WSL desktop notify package" would mean forcing TCP on everything else. And no one would do that. This is why dbus-broker just scrapped the idea entirely (search "Local Only" in the article).
therealkencSunil Muthuswamy (@sunilmut) This can probably be looked at now using AF_Unix interop. Not sure how simple it would be but it would be nice to have this small but useful feature. There should probably be an option to toggle it on or off and ensure notifications respect becoming silenced using "Quiet Hours".
I was just thinking about how the new AF_UNIX interop stuff could fit into this. As far as I understand it, a socket can only be consumed from Win32 land if it is created within the path of a Win32 accessible filesystem, and can then only be accessed by the creator (on the UNIX side), and Win32 apps.
D-Bus should be able to create two UNIX sockets and listen on both, one for the unix side in /tmp, and one on the Win32 side, on an NTFS partition. This can be done with extra <listen> entries in the dbus config.
I still don't understand why TCP isn't a satisfactory solution to this though, since a D-Bus daemon can listen on both UNIX socket and TCP (the "ssh tunneling" mentioned by the article above still requires TCP connections). Now the dbus daemon will just be listening on two UNIX sockets instead.
I still don't understand why TCP isn't a satisfactory solution to this though
It isn't not a satisfactory solution. :)
It is just pointlessly complicated when you can use wsl.exe (aka WslLaunch) and listen to the messages on stdin. You can put another <listen> entry in the dbus conf (TCP socket, Unix named socket, Unix abstract socket matters not), but now you've made the Ubuntu dbus package dependent on your "WSL notifier" package; because dbus owns that configuration file. Which is upside-down.
So yes. You could write a Windows program with a port of the dbus protocol which opens a Unix socket or TCP socket, and write a postinstall script on the WSL side to fix up the dbus conf; which will be clobbered on the next dbus apt upgrade. Or... you could listen on stdin. Whichever makes for the most fun as a time sink I guess. Not much fun it would appear, because no one has since August.
$ alias toast='powershell.exe -command New-BurntToastNotification'
And finally:
$ toast -Text hello
FTFY
Reacted by Martin Simon, zhangnew, Malcolm, Anton Rudeshko, Matthew Rutkowski, bryango, Milán Nagy, TakashiAihara, Christian P., Brian Shenk and 17 more
So a follow-up on this, just because I took the time-sink to do a "what would it take" look. I hacked up notification-thing to spawn New-BurntToastNotification instead of popping up a GTK3+ window. It even has a liberal license. We're talking trivial changes here. That gets you a working notify-send from libnotify-bin as asked for in the OP.
Long story short (I've deleted a third of this post), The Desktop Notifications Specification operates in a session. This isn't related to the <listen> option in /usr/share/dbus-1/system.conf (AF_UNIX or otherwise). You can in theory and practice create a remote login dbus session for every WSL terminal, which goes to Ben's comment in #816 (here). But the end result is you're just talking to yourself. It doesn't matter whether you are connected to the session bus from the Windows side or the WSL side (there isn't really a "side" -- it is a bus). I'm pretty sure you could run the same hacked up notification-thing with dbus-python for Windows.
But either way, you are literally firing up a dbus session on every terminal for the privilege of sending a message right back to yourself to spawn New-BurntToastNotification (or your own re-implementation thereof). Which, you can just call directly per yesterday's message, and avoid the drama.
This puts the "feature request" in an awkward state. Possibilities being:
(1) People just want to get a Win 10 notification, somehow, from the WSL commandline. Which we could do since interop went live.
(2) People actually want a session bus started on every terminal instance. This would live in their /etc/pam.d/wsld on Debian derived distros. Which worms fast, and is why #1405 is frozen in time.
(3) This is a coded request for Gnome sessions, because GTK+ is In Real Life the only thing that calls libnotify. Which is out of scope.
I've been trying to get the BurntToast notifier going in WSL.. and I constantly get this error... and I'mnot sure how to fix it..
Exception calling "CreateToastNotifier" with "1" argument(s): "The data area passed to a system call is too small. (Exception from
HRESULT: 0x8007007A)"
At C:\Program Files\WindowsPowerShell\Modules\BurntToast\0.8.5\BurntToast.psm1:2478 char:9
+ [Windows.UI.Notifications.ToastNotificationManager]::CreateTo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Exception
Reacted by Will, Victor Jose Hidalgo de la Hoz, Zhang Minghao, David Karlsson and Moabe L.
Not to bump an old thread, but a way this might be achievable is tracked in microsoft/terminal#7718. The way I've got it implemented in microsoft/terminal#14425, an app can do something like:
printf"\x1b]777;notify;Hello From the Terminal;This is a notification sent by the client application\x07"
And that'll send a Windows toast.
It's not exactly the same thing as all the dbus and notify-send chatter above, but I bet it'll achieve the same goal.
I've been trying to get the BurntToast notifier going in WSL.. and I constantly get this error... and I'mnot sure how to fix it..
Exception calling "CreateToastNotifier" with "1" argument(s): "The data area passed to a system call is too small. (Exception from
HRESULT: 0x8007007A)"
At C:\Program Files\WindowsPowerShell\Modules\BurntToast\0.8.5\BurntToast.psm1:2478 char:9
+ [Windows.UI.Notifications.ToastNotificationManager]::CreateTo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Exception
Having the same issue. It works when done from the Windows side, but not inside WSL.
I've been trying to get the BurntToast notifier going in WSL.. and I constantly get this error... and I'mnot sure how to fix it..
Exception calling "CreateToastNotifier" with "1" argument(s): "The data area passed to a system call is too small. (Exception from
HRESULT: 0x8007007A)"
At C:\Program Files\WindowsPowerShell\Modules\BurntToast\0.8.5\BurntToast.psm1:2478 char:9
+ [Windows.UI.Notifications.ToastNotificationManager]::CreateTo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Exception
Activity
sunilmut commentedon Sep 5, 2017
Thanks for the idea. Marking it so. Please open a ticket at the WSL user voice for any feature requests. It helps us prioritize for future.
crozone commentedon Sep 6, 2017
libnotify uses the Desktop Notifications Specification, which works on top of D-Bus.
This means that the solution can probably already be accomplished by writing a Windows-land daemon that connects to the Linux-land D-Bus daemon over TCP, and creates Windows notification popups. I might even give this a go in C# if it's not too hard.
Unless the BoUoW team want to enable a way for the Linux D-Bus to be shared in another way (like allow Windows applications to consume a Unix pipe/socket, somehow...), and also build the notification client into the terminal, I'm not sure how much they can do.
sunilmut commentedon Sep 6, 2017
Ryan Crosby (@crozone) - Interesting. I am just trying to visualize how this would work. So, the
notify-send(or any other command) would go overlibnotifyto the WSL D-Bus service, which can publish the message over to theDesktop Notification Specificationinterface. And, if there is a Win32 Desktop Notification server that can consume these messages, then it can create the necessary popups?crozone commentedon Nov 22, 2017
Sunil Muthuswamy (@sunilmut) sorry for the massively delayed reply, but yes.
The trick is that the win32 application can connect to the Linux D-Bus using a TCP connection to localhost. In theory, it would make the most sense for an X Window Sever (like XMing) to implement it on the win32 side, since IIRC it already establishes a connection to a D-Bus channel relating to that desktop. However, failing that, a stand alone application can work, but I'm not 100% sure how it would find the right D-Bus channel.
therealkenc commentedon Nov 22, 2017
Wrong protocol. All the
dbusaction happens on the WSL side; an X Server (be it XMing, VcXsrv, native Linux Xorg) has no knowledge ofdbusor what is being displayed in a popup window. It speaks X11 protocol.The guys who obscure half their screen with Ubuntu wallpaper over in #637 already have desktop notifications.
notify-sendworks fine for them; or at least, it should. I think you can fire upunity-notificationsalone and get exactly what you describe (ignoring thatunity-notificationsprobably falls on its face without Unity around). Thexfce4guys have something similar.If all you want is CLI
notify-send, actual Win32 Desktop Notifications, and no X11 to speak of, you could write your own Desktop Notification Specification service like Sunil describes. But thedbussession server and the notification client still live on the WSL side, communicating over an AF_UNIX socket. Typically you'd talk to the service using ssh.Basically, on the Windows side you write an app that remote launches (on WSL) some Python script that sits there waiting for Desktop Notification Specification messages to arrive, and spits the notification text out to
stdoutin some formatted manner. Then on the windows side when new message text arrives over ssh you push a Windows Desktop notification.I mean, in a fever dream kind of way.
crozone commentedon Nov 24, 2017
Ahh, thanks. I thought there was some magic there that would allow X apps to "find" the D-Bus channel for that session, but maybe that's something else.
I'm pretty sure you don't need to do this though, you can get D-Bus to listen for TCP connections, instead of just the AF_UNIX socket. This would let the Windows-land client speak to the Linux-land D-Bus, and therefore the the notification protocol, entirely natively.
therealkenc commentedon Nov 24, 2017
Yeah I almost mentioned that but didn't want to yammer (knowing in my heart someone would bring it up anyway). That is technically correct, but would mean the mother-of-all dependency inversions. In other words, installing a hypothetical "WSL desktop notify package" would mean forcing TCP on everything else. And no one would do that. This is why
dbus-brokerjust scrapped the idea entirely (search "Local Only" in the article).WSLUser commentedon Mar 2, 2018
therealkenc Sunil Muthuswamy (@sunilmut) This can probably be looked at now using AF_Unix interop. Not sure how simple it would be but it would be nice to have this small but useful feature. There should probably be an option to toggle it on or off and ensure notifications respect becoming silenced using "Quiet Hours".
crozone commentedon Mar 5, 2018
I was just thinking about how the new AF_UNIX interop stuff could fit into this. As far as I understand it, a socket can only be consumed from Win32 land if it is created within the path of a Win32 accessible filesystem, and can then only be accessed by the creator (on the UNIX side), and Win32 apps.
D-Bus should be able to create two UNIX sockets and listen on both, one for the unix side in /tmp, and one on the Win32 side, on an NTFS partition. This can be done with extra
<listen>entries in the dbus config.I still don't understand why TCP isn't a satisfactory solution to this though, since a D-Bus daemon can listen on both UNIX socket and TCP (the "ssh tunneling" mentioned by the article above still requires TCP connections). Now the dbus daemon will just be listening on two UNIX sockets instead.
therealkenc commentedon Mar 5, 2018
It isn't not a satisfactory solution. :)
It is just pointlessly complicated when you can use
wsl.exe(aka WslLaunch) and listen to the messages onstdin. You can put another<listen>entry in the dbus conf (TCP socket, Unix named socket, Unix abstract socket matters not), but now you've made the Ubuntudbuspackage dependent on your "WSL notifier" package; because dbus owns that configuration file. Which is upside-down.So yes. You could write a Windows program with a port of the dbus protocol which opens a Unix socket or TCP socket, and write a postinstall script on the WSL side to fix up the dbus conf; which will be clobbered on the next dbus apt upgrade. Or... you could listen on
stdin. Whichever makes for the most fun as a time sink I guess. Not much fun it would appear, because no one has since August.therealkenc commentedon Mar 5, 2018
Or the other direction; even easier.
In Windows, launch Powershell as Administrator and do:
On WSL:
And finally:
FTFY
therealkenc commentedon Mar 6, 2018
So a follow-up on this, just because I took the time-sink to do a "what would it take" look. I hacked up
notification-thingto spawn New-BurntToastNotification instead of popping up a GTK3+ window. It even has a liberal license. We're talking trivial changes here. That gets you a workingnotify-sendfromlibnotify-binas asked for in the OP.Long story short (I've deleted a third of this post), The Desktop Notifications Specification operates in a session. This isn't related to the
<listen>option in/usr/share/dbus-1/system.conf(AF_UNIXor otherwise). You can in theory and practice create a remote login dbus session for every WSL terminal, which goes to Ben's comment in #816 (here). But the end result is you're just talking to yourself. It doesn't matter whether you are connected to the session bus from the Windows side or the WSL side (there isn't really a "side" -- it is a bus). I'm pretty sure you could run the same hacked upnotification-thingwith dbus-python for Windows.But either way, you are literally firing up a dbus session on every terminal for the privilege of sending a message right back to yourself to spawn New-BurntToastNotification (or your own re-implementation thereof). Which, you can just call directly per yesterday's message, and avoid the drama.
therealkenc commentedon Mar 6, 2018
This puts the "feature request" in an awkward state. Possibilities being:
(1) People just want to get a Win 10 notification, somehow, from the WSL commandline. Which we could do since interop went live.
(2) People actually want a session bus started on every terminal instance. This would live in their
/etc/pam.d/wsldon Debian derived distros. Which worms fast, and is why #1405 is frozen in time.(3) This is a coded request for Gnome sessions, because GTK+ is In Real Life the only thing that calls
libnotify. Which is out of scope.16 remaining items
xuanruiqi commentedon Aug 9, 2021
Would it be possible to make an alternate implementation of libnotify based on WSL-Windows interaction mechanisms?
bartdorsey commentedon Mar 30, 2023
I've been trying to get the BurntToast notifier going in WSL.. and I constantly get this error... and I'mnot sure how to fix it..
zadjii-msft commentedon Aug 22, 2023
Not to bump an old thread, but a way this might be achievable is tracked in microsoft/terminal#7718. The way I've got it implemented in microsoft/terminal#14425, an app can do something like:
And that'll send a Windows toast.
It's not exactly the same thing as all the dbus and
notify-sendchatter above, but I bet it'll achieve the same goal.Davikar commentedon Aug 27, 2023
Having the same issue. It works when done from the Windows side, but not inside WSL.
b-hayes commentedon Aug 28, 2023
NGL I can't believe this is still not a thing. Every terminal on every system except windows can do this.
kmantel commentedon Sep 19, 2023
This feels silly but worked for me
powershell powershell.exe -Command New-BurntToastNotificationmoabel commentedon Oct 5, 2023
I can't believe this actually worked. I had to do it this way:
powershell.exe powershell.exe -Command New-BurntToastNotificationshanselman commentedon Feb 25, 2024
Would be cool Craig Loewen (@craigloewen-msft)
ultrabig commentedon Feb 25, 2024
I created an impelementation using Windows native functionality.
https://github.com/ultrabig/WslNotifyd
RAraghavarora commentedon May 22, 2024
Boosting this for notifications more than single word!!
pomodoro: Add WSL support
4-FLOSS-Free-Libre-Open-Source-Software commentedon Nov 20, 2024
Could you as workaround mirror notifications from WSL2 ⇒ Windows via KDE Connect?
ForbiddenEra commentedon Mar 9, 2026
<3 (except not providing a binary.. I don't build windows stuff)
petrroll commentedon Jul 23, 2026
Would be useful for e.g. using herdr (https://herdr.dev/) in WSL