Please anyone can help me with a userscript for Fluid with notifications not working?

9 views
Skip to first unread message

Jorge Luis Genova

unread,
Nov 21, 2018, 11:35:21 AM11/21/18
to Growl Discuss
Hello everyone, first, sorry for my english, and also I'm not a devolper or anything, I just search info in google and try make it work. I'm trying to have Asana (Fluid App) with notifications.

I was able to have a badge, a sound, and a bouncing icon in the dock when I have a new alert in the Asana Inbox (please se attachment 1). 
But I can't make growl notifications to work.

This is de userscript working (sound, badge and bouncing icon):

// For use with fluidapp.com (pro version)

(function() {
    // changes the favicon. avoids setting the same favicon twice.
    function updateFavicon(unread) {
    if(this.lastState != unread) { // ensures we're not changing the icon all the time
            window.fluid.dockBadge = unread ? '★' : '';
            window.fluid.requestUserAttention(true);
            window.fluid.playSound("Tink") ; 
        this.lastState = unread;
        }
    }
    
    // checks read count and updates favicon if necessary
    function updateRead(title) {
        var unread = title.indexOf("●") == 0;
        updateFavicon(unread);
    }
    
    // observes any changes in the title and checks for the unread mark
    function install() {
        var titleNode = document.querySelector('head > title');
        this.observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                var newTitle = mutation.target.textContent;
            updateRead(newTitle);
            });
        });
        observer.observe(titleNode, { subtree: true, characterData: true, childList: true }); // options counter-intuitive to me, but are required, not too expensive
        updateRead(document.title); // make sure it's up to date before first event
    }
    
    install();
})();
 




And then I try to add notification like this, what am I doing wrong? :

// For use with fluidapp.com (pro version)

(function() {
    // changes the favicon. avoids setting the same favicon twice.
    function updateFavicon(unread) {
     if(this.lastState != unread) { // ensures we're not changing the icon all the time
            window.fluid.dockBadge = unread ? '★' : '';
            window.fluid.requestUserAttention(true);
            window.fluid.playSound("Tink") ; 
            window.fluid.showGrowlNotification({
            title: "Title",
            description: "Description"
                                });
        this.lastState = unread;
        }
    }
    
    // checks read count and updates favicon if necessary
    function updateRead(title) {
        var unread = title.indexOf("●") == 0;
        updateFavicon(unread);
    }
    
    // observes any changes in the title and checks for the unread mark
    function install() {
        var titleNode = document.querySelector('head > title');
        this.observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                var newTitle = mutation.target.textContent;
            updateRead(newTitle);
            });
        });
        observer.observe(titleNode, { subtree: true, characterData: true, childList: true }); // options counter-intuitive to me, but are required, not too expensive
        updateRead(document.title); // make sure it's up to date before first event
    }
    
    install();
})();
 


I do have latest growl installed on mac os high sierra. All enabled, I tried the growl option "OS X notification" on and off.

Any idea? Thank you very much!



Screen Shot 2018-11-21 at 1.00.53 PM.png

Chris Forsythe

unread,
Nov 21, 2018, 11:48:00 AM11/21/18
to Growl Discuss
I'll say I don't know javascript very well, however some examples I'm seeing have the syntax slightly different.


I'd suggest trying to make a simple sample app which is like this to see if you can fire a notification, then trying to graft it onto what you're doing.

Also your english is fine, don't worry about it. If you at some point need to explain in another language we do have people on this list who can help translate, and we can figure things out. Your english itself is great though, no apologies necessary. :)

--
You received this message because you are subscribed to the Google Groups "Growl Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growldiscuss...@googlegroups.com.
To post to this group, send email to growld...@googlegroups.com.
Visit this group at https://groups.google.com/group/growldiscuss.
For more options, visit https://groups.google.com/d/optout.


--
Chris Forsythe

Jorge Luis Genova

unread,
Nov 21, 2018, 12:13:40 PM11/21/18
to Growl Discuss
Thank you for you kind words!
 
 "I'd suggest trying to make a simple sample app which is like this to see if you can fire a notification, then trying to graft it onto what you're doing."

I don't know how to do a simple sample app, as I said I'm not a developer :( I just used fluid app with asana.com. Then I copy/paste the script I found in the userscript window.
Reading other topics here in this group, I've found that my Growl is not detecting the "Asana  app". Look at the attachment, with growl opened, I launched transmission and it suddenly appeared in the configuration panel of growl. But if I launch Asana App It doesn't add to growl list.

Maybe Fluid is not supporting anymore growl?

I will write to the Fluid App support maybe they can confirm if it is possible to call growl using scripts witn an app made with fluid.
I will write their answer here.
Screen Shot 2018-11-21 at 1.58.25 PM.png

Chris Forsythe

unread,
Nov 21, 2018, 12:26:39 PM11/21/18
to Growl Discuss
That may be the case, essentially we're providing Growl at this point for notification power users but in reality it'll likely be scripters/administrators/power users who continue to use Growl in the coming years. 

Let us know what Asana says.
Reply all
Reply to author
Forward
0 new messages