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

Is there a workaround to getting gulp-notify to work from LSX? #2180

Closed
alanosman opened this issue May 31, 2017 · 14 comments
Closed

Is there a workaround to getting gulp-notify to work from LSX? #2180

alanosman opened this issue May 31, 2017 · 14 comments

Comments

@alanosman
Copy link

alanosman commented May 31, 2017

Hi everyone,

I have fully migrated my development tools over to Windows LSX, but have one small nitpick.

I'm using gulp with my node app, working on saas and jsx files. Every now and then I make a typo and my gulp watch fails and I don't get notified. This used to obviously work from cygwin.

I did some research and found that Ubuntu requires a package called libnotify-bin to get notifications, but that talks about the native Ubuntu desktop. I went ahead and installed it anyway and it silenced the error I was seeing Could not send message: not found: notify-send, but still no notifications come through to Windows.

I would suspect there is no bridge between Ubuntu's notifications and Windows, right? or is there?

  • I'm using Windows 10 Pro, 15063.296, latest production release.
  • The relevant lines of code in my gulpfile are:
'use strict';

const chalk         = require('chalk');
const gulp          = require('gulp');
const sass          = require('gulp-sass');
const gutil         = require('gulp-util');
const eslint        = require('gulp-eslint');
const notify        = require('gulp-notify');
const plumber       = require('gulp-plumber');
const requirejs     = require('requirejs');
const buildConfig   = require('./build');

const GULP_WATCH_INTERVAL = 750; // Milliseconds
const GULP_WATCH_OPTS     = { interval: GULP_WATCH_INTERVAL };

const sassCompiler = (src, dest) =>
    gulp.src(src)
        .pipe(plumber({
            errorHandler:  notify.onError('SAAS error: <%= error.message %>')
        }))
        .pipe(sass({
            outputStyle:     'compressed',
            errLogToConsole: true,
        }))
        .pipe(gulp.dest(dest));

gulp.task('sass', () =>
    sassCompiler('.//sass/**/*.scss', './public/css'));
  • I should be seeing a Windows desktop notification when notify.onError('SAAS error: <%= error.message %>') fires.
@aseering
Copy link
Contributor

aseering commented Jun 1, 2017

Hey @alanosman , thanks for posting! But could you please fill out the issue template? Some of the questions there, notably the one about your exact Windows version, have a direct bearing here.

Also, are you working with files under /mnt, or in your Linux home directory or somewhere else? Different WSL filesystems added support for filesystem notifications in different Windows versions.

@alanosman
Copy link
Author

@aseering sorry - didn't think it would be relevant at the time of writing, but of course it is. I've updated my original description for you. thanks!!

@alanosman
Copy link
Author

alanosman commented Jun 1, 2017

@aseering forgot to add that I am working under /mnt.. yes. I have my d-drive mounted on /mnt and I use symbolic links to create access folders to those that I work on on d-drive from my home/aosman directory .

Are you thinking that it's something to do with that?

@aseering
Copy link
Contributor

aseering commented Jun 2, 2017

Hi @alanosman -- sorry for the delay, I was hoping someone else might jump in as I don't remember the exact details in this case :-) I believe that your build is new enough that it should support filesystem notifications for files located in either DrvFs (/mnt) or VolFs (/home, etc). So I'm a little surprised that this doesn't work for you. There's a lot of discussion of this on #216 , though, including the timeline of the fix as well as various workarounds; you could read and/or ask there.

@benhillis
Copy link
Member

@alanosman - Can you clarify what you mean by "windows desktop notification?" WSL doesn't native support an type of UI framework that would be able to pop notifications on the Windows desktop.

@alanosman
Copy link
Author

alanosman commented Jun 2, 2017

Hi @benhillis - yes, I mean the little black toast that appears when I get messages on Windows 10.

Are you saying that there is no way to drive that from within WSL? Is there some plan for that? My case specifically is with gulp or anything that tries to fire a notification.

When you run gulp on Windows (say from DOS or Cygwin) it manages to fire the desktop notification. Apple supports this on their desktop / terminal mode. It would make sense for Windows to do the same. We're not running production software, just developing on it, and this is something us developers/testers/themers could certainly benefit from.

Let me know if you need more info.

Alan

@benhillis
Copy link
Member

@alanosman - WSL doesn't have any access to NT's Window manager unless you use an X-11 server. Have you tried that?

@alanosman
Copy link
Author

@benhillis no.. I have no Windows experience with X-11 Server only what I can vaguely remember from my Sun Sparc computing days. Sounds like a lot of effort for a notification.

Is there a plan at your end to make it work? Has anyone else asked for this?

@benhillis
Copy link
Member

benhillis commented Jun 2, 2017

@alanosman - No current plan to hook any Linux notifications up to Windows UI notifications. If this is something you feel strongly about I'd suggest creating a ticket on our User Voice page.

@alanosman
Copy link
Author

OK - well thanks.. I'll close this out

@JacobDB
Copy link

JacobDB commented Jun 20, 2017

I'd like to see this too, will check the UserVoice.

EDIT: Links to User Voice pages for those who are interested are below.

@armpogart
Copy link

A little bit more info that could be helpful, gulp-notify uses node-notifier which in this case (ubuntu) tries to use notify-osd which is installed by default on ubuntu, so the solution would be to find out low level api there and map it to Windows Toast notifications API.

Also I think it would be better to reopen the issue until there will be fix or official no-fix from developers. But I would suggest to look in a way to implement it in future as many dev environments and tools use native notifications. Anyway it would be better if this issue stays open for now.

@stereokai
Copy link

Would like to bring back attention to this. This should be fairly easy to do. To quote again:

use notify-osd which is installed by default on ubuntu, so the solution would be to find out low level api there and map it to Windows Toast notifications API.

@xaositects
Copy link

xaositects commented Feb 25, 2019

I wrote a couple scripts (one powershell and one bash) to get this to work in a roundabout way.

WSLNotifications

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

7 participants