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

node-notifier not working in wsl2 #400

Open
wbern opened this issue Mar 1, 2022 · 6 comments
Open

node-notifier not working in wsl2 #400

wbern opened this issue Mar 1, 2022 · 6 comments

Comments

@wbern
Copy link

wbern commented Mar 1, 2022

Hey!

I'm using wsl2 Ubuntu and integrated terminal with vscode and windows 10.

I don't get any errors but it seems I don't get any notifications? I couldn't find and previous issues about this, but is there something I need to set up? I've got the DISPLAY variable assigned to my local ip:0.0 as well.

I'm using it like this.

import notifier from "node-notifier"

notifier.notify({
  title: 'My notification',
  message: 'Hello, there!'
});

Thanks in advance.

@wbern
Copy link
Author

wbern commented Mar 1, 2022

I just tried using powershell and it doesn't seem to work either.

@wbern
Copy link
Author

wbern commented Mar 1, 2022

This is what I get back as result using wsl2

image

@stsourlidakis
Copy link

stsourlidakis commented Apr 26, 2022

Hello
I have the same issue, it seems that the problem only occurs when the package is installed under the WSL2 file system.
If the package is installed under the Windows file system (/mnt/c/...) and you try to use it in WSL2, the notifications work as expected.

Steps to reproduce:
Open a WSL2 window

cd ~
mkdir test-node-notifier
cd test-node-notifier
npm i node-notifier
node
> const notifier = require("node-notifier");
> notifier.notify({ title: "Hey", message: "Hello" });

If you run the reproduction steps in a Windows path (e.g. under /mnt/c/Users/<your-username>/) you will get the notification without issues.

Note: If I manually chmod +x on snoreToast/snoretoast-x*.exe (as per #353) the issue is fixed.

Thank you for your time.

@stsourlidakis
Copy link

This will probably be fixed if the permissions for the 2 binaries are updated (chmod +x) and committed again.
I can open a pull request if you agree @mikaelbr.

@JimmayVV
Copy link

WSL2 support via the binaries would be wonderful. I do understand there's a workaround to manually apply the execution bit, but a fix targeting WSL compatibility would be a huge win for Windows users.

@orgrimarr
Copy link

It's working using WindowsBalloon on my installation (WSL ubuntu on W11)

Maybe switch WindowsToaster to WindowsBalloon for WSL installtion or use WindowsBalloon as a fallback ?

import isWsl from "is-wsl";
import notifier from "node-notifier";
if (isWsl) {
  new notifier.WindowsBalloon({}).notify(
    { title: 'WindowsBalloon', message: 'Hello from WSL using WindowsBalloon' }
  );
}

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

4 participants