-
Notifications
You must be signed in to change notification settings - Fork 826
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
Feature Request: Desktop Notifications #2466
Comments
I agree. It probably does not have a huge priority presently though. There will be a larger update towards the middle of October so perhaps afterwards some lower priority things may receive more attention. :) |
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. |
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. |
@crozone - Interesting. I am just trying to visualize how this would work. So, the |
@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. |
Wrong protocol. All the The guys who obscure half their screen with Ubuntu wallpaper over in #637 already have desktop notifications. If all you want is CLI 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 I mean, in a fever dream kind of way. |
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. |
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 |
@therealkenc @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 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. |
It isn't not a satisfactory solution. :) It is just pointlessly complicated when you can use 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 |
Or the other direction; even easier. In Windows, launch Powershell as Administrator and do:
On WSL:
And finally:
FTFY |
So a follow-up on this, just because I took the time-sink to do a "what would it take" look. I hacked up 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 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 (3) This is a coded request for Gnome sessions, because GTK+ is In Real Life the only thing that calls |
It would be awesome to have a project that listeners some error logs and send notifications to windows accordingly. It would also be awesome when i would have all my side project finished so i could build this |
@therealkenc personally I'd be happy with the first option. I just want gulp-notify to be able to send me toast notifications. |
Yep. Use a custom notifier and call 'powershell.exe -command New-BurntToastNotification' with |
@therealkenc oh that's awesome, completely missed that. Thanks, will try to get it integrated in to my system. |
Great. I think your necropost is probably enough motivation to put this one to bed. The only way this issue can be turned into a WSL actionable is possibility (2). That is highly problematic because WSL is distribution agnostic, and any solution would necessitate overloading WSL's Which is just too horrible to contemplate, because having implemented all of that, it gets us nothing option (1) can't do. UserVoice won't save us here. |
Any update on this? |
Like the idea of this one but seems there's a lot of hoops to jump through to get it working.
|
You need to set your ExecutionPolicy to unrestricted to make it work. Run Powershell in administrator mode and run the command "Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine". It worked for me after that though the alias was not working for text that ran beyond a single word so I instead made a bash function as follows
Stick that into your bashrc (or whatever rc your particular shell happens to use) and you should be good to go. |
Changing the execution policy directly using Set-ExecutionPolicy works, but leaves your machine open to malicious scripts. I'm not a fan of this approach. I think it's better to leave it set to Restricted. Instead, I set my alias in WSL to this:
I'm not an expert at Powershell by any means, but as far as I know, this bypasses the execution policy only for this call. That way Powershell can stay restricted by default, but this WSL alias will bypass this and run the toast. |
@therealkenc Since we're getting GUI support for WSL2, I think this issue could be re-opened. This could now be done behind the scenes and also could simply be a configuration option in /etc/wsl.conf if we want Win 10 notifications vice native Linux notifications popping up. I think I'd prefer Win 10 though, easier to manage that way. |
The ask isn't related to GUI support, which was explained in May 2018 (message). That is the case whether X11 or Wayland. You can of course get a Linux GUI notification, but that wasn't the ask. The ask was for Windows notifications. Linux GUI notification popups, meanwhile, would be all userspace. That said, there is no User Voice anymore (there was in 2017), so, sure, re-opening on feature request loophole. |
Would it be possible to make an alternate implementation of libnotify based on WSL-Windows interaction mechanisms? |
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..
|
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 |
Having the same issue. It works when done from the Windows side, but not inside WSL. |
NGL I can't believe this is still not a thing. Every terminal on every system except windows can do this. |
This feels silly but worked for me
|
I can't believe this actually worked. I had to do it this way:
|
Would be cool @craigloewen-msft |
I created an impelementation using Windows native functionality. |
Boosting this for notifications more than single word!!
|
Disable notifications there until microsoft/WSL#2466 is resolved. Also use `(( ))` as opposed to `-eq 1`.
Could you as workaround mirror notifications from WSL2 ⇒ Windows via KDE Connect? |
Desktop notifications from Linux apps don't appear in Windows, it would be nice if this could work.
Example test:
$ sudo apt-get install libnotify-bin
$ notify-send "TEST"
Feature request is to have the notification interface to allow the action center to receive notifications.
The text was updated successfully, but these errors were encountered: