Growl notifications

Share your scripts and packages with other Mudlet users.
naftali
Posts: 138
Joined: Wed Jan 20, 2010 8:42 pm

Growl notifications

Post by naftali »

Function to create growl notifications easily - download and install Growl from growl.info and make sure you also follow the instructions to install the "growlnotify" extra.

Growl is a nifty thing that creates popups, works with lots of applications. Personally I think it'd be cool to integrate it into Mudlet directly, maybe even through the UI, ESPECIALLY if the API for telling if the window is in focus ever happens.

Anyway, usage:

growlNotify("Test","Hey guys, this is a test!")
creates:Image

That's pretty much all there is to it. Something to note is that you need to use the full path of growlnotify, so if you install it somewhere other than the default place (/usr/local/bin/growlnotify) you need to change the path in the function here. Also, this currently works for Mac, dunno how I could make it work for Windows or Linux so if you do then please, post the changed script.
Code: [show] | [select all] lua
function growlNotify(title, message)
	local path, icon
	path = "/usr/local/bin/growlnotify"
	icon = "-a Mudlet.app"
	message = message or ""
	title = title or "test"
	os.execute( path .. " " .. icon .. " -m '" .. message .. "' " .. title )
end

Knute
Posts: 87
Joined: Fri Mar 05, 2010 12:08 am

Re: Growl notifications

Post by Knute »

Linux has notify-send, that works with the notification daemon, or notify-osd.

And a quick search on my arch system shows a haskell-growlnotify package.

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

for KDE users

Post by demonnic »

Here's one using kdialog for KDE.

you could also use it in gnome, if you have kdialog installed.

Code: [show] | [select all] lua
function kdeNotify(title, message, timeout)
        local path
        path = "/usr/bin/kdialog"
        message = message or ""
        title = title or "Mudlet"
        if type(timeout) ~= "number" then timeout = 10 end
        os.execute( path .. " --title \"" .. title .."\" --passivepopup \"" .. message .. "\" .. timeout )
end

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Growl notifications

Post by Jules »

Is there a Growl application for Windows? Or do you just have to use the pop-up bubbles from the system tray on the task bar? And if that's only the case... How do you use the system tray bubbles?

This is a pretty sweet function, I'm quite impressed!

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Growl notifications

Post by Vadi »

I posted the ones for Linux half a year ago: http://forums.mudlet.org/viewtopic.php? ... lit=notify

Denarii
Posts: 111
Joined: Thu Dec 03, 2009 10:54 pm

Re: Growl notifications

Post by Denarii »

For Windows, there's Snarl.

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: Growl notifications

Post by demonnic »

yeah, but I couldn't find notify-send on the box I was on right that moment, so I used kdialog. hence why I specified that one for kde users. heh.

User avatar
Alexander Divine
Posts: 65
Joined: Mon Dec 21, 2009 7:01 pm

Re: Growl notifications

Post by Alexander Divine »

After a couple of minutes messing with Snarl, here's what I came up with.

You'll also need to download the Snarl_CMD application, found here. For ease I simply extracted it into my C: drive.

Notable issue: When calling os.execute() you get this brief flash of the command shell window opening. Annoying as hell, but the script still works!
Code: [show] | [select all] lua
function snarlNotify(title, message)
  local path, command
  path = "C:\\Snarl_CMD.exe"
  command = " snShowMessage 10 "
  message = message or ""
  title = title or "Mudlet Notification"
  os.execute(path .. command .. '\"' .. title .. '\" \"' .. message .. '\"')
end

User avatar
Rakon
Posts: 350
Joined: Tue Feb 16, 2010 7:41 pm
Contact:

Re: Growl notifications

Post by Rakon »

Courtesy of Vadi, and with my simple modifications, here is one for Debian/Ubuntu systems using notify-send:

It will only send the notification if the main Mudlet window is NOT in focus.
Code: [show] | [select all] lua
function notify (...)
 if hasFocus() == false then
   os.execute(string.format("%s", [[notify-send --icon="/usr/share/app-install/icons/mudlet.png" "Mudlet" "]] .. ... .. [["]]))
 end -- if
end -- notify
Image

naftali
Posts: 138
Joined: Wed Jan 20, 2010 8:42 pm

Re: Growl notifications

Post by naftali »

I'll be damned. When did someone add in a hasFocus() function? And when are these things gonna be included in the bloody manual?!? (note: this last is not meant to be accusing Vadi of slacking, I know it's hard to keep it updated)

Post Reply