It is in the manual actually: http://mudlet.org/asciidoc/manual.html#hasFocus
I just can't update the main one, only Heiko can.
Growl notifications
Re: Growl notifications
From what I can tell, hasFocus() was added in the last update (1.1.1).
For those of you using Snarl for windows, here is another way to handle doing notifications, using the snarl network protocal. Its a lot more long winded then just calling os.execute, but it means you don't have to put up with the the command window popping up each time you send a notification.
In order to get it to work, I had to download and place the LuaSocket library from here, and place the socket and mine folders, and the .lua files inside the lua folder, into "C:\Documents and Settings\<user>\Local Settings\Application Data\Mudlet. I also placed the socket folder inside the lua folder into "C:\Documents and Settings\<user>\.config". I'm not sure if I got the folders right..but everything seems to work. I also wasn't sure if there was already a inbuilt way to handle TCP sockets already built into Mudlet, but couldn't seem to find anything.
The following code will allow you to send notifications using Snarl:
Its not exactly pretty, and it may be buggy (I've been playing with it all day, and it seems to work fine), but it does the job.
Just call Snarl.startup() at some point to enable notifications.
Snarl.notify(title, message, timeout, icon, class) - Allows you to send a notification. Only title and message are required, with the default timeout and icon set using the Snarl.defaultTimeout and Snarl.mudletIcon variables at the top of the script.
Wyd
For those of you using Snarl for windows, here is another way to handle doing notifications, using the snarl network protocal. Its a lot more long winded then just calling os.execute, but it means you don't have to put up with the the command window popping up each time you send a notification.
In order to get it to work, I had to download and place the LuaSocket library from here, and place the socket and mine folders, and the .lua files inside the lua folder, into "C:\Documents and Settings\<user>\Local Settings\Application Data\Mudlet. I also placed the socket folder inside the lua folder into "C:\Documents and Settings\<user>\.config". I'm not sure if I got the folders right..but everything seems to work. I also wasn't sure if there was already a inbuilt way to handle TCP sockets already built into Mudlet, but couldn't seem to find anything.
The following code will allow you to send notifications using Snarl:
Its not exactly pretty, and it may be buggy (I've been playing with it all day, and it seems to work fine), but it does the job.
Just call Snarl.startup() at some point to enable notifications.
Snarl.notify(title, message, timeout, icon, class) - Allows you to send a notification. Only title and message are required, with the default timeout and icon set using the Snarl.defaultTimeout and Snarl.mudletIcon variables at the top of the script.
Wyd
Re: Growl notifications
I think it'll be worthwhile to merge these into a single notify function for all platforms once mudlet ships with luasocket. we'd have to note in the manual that for pretty much each platform you have to install the proper programs.
Re: Growl notifications
There is also in Qt the QSystemTrayIcon (docs here) that looks like it has balloon popups with QSystemTrayIcon::showMessage(). Maybe not as fancy looking as standalone notification packages, but it is already included with Qt and cross platform (well, mac needs to install growl).
In addition, a small menu could be associated with the system tray icon so that when you click on it, it has a list of the last 5,10,whatever messages sent.
As for requiring these other notification packages, could the installer be modified to check for them and give a prompt if they're not detected?
In addition, a small menu could be associated with the system tray icon so that when you click on it, it has a list of the last 5,10,whatever messages sent.
As for requiring these other notification packages, could the installer be modified to check for them and give a prompt if they're not detected?
Re: Growl notifications
On Debian Lenny notify-send is not installed by default. Using the instructions from here I installed libnotify-bin and notifications work now. Pretty cool!Rakon wrote: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.
Re: Growl notifications
The original growl code at the top was a bit lacking. Notable, anything with the ' character would kill it, due to limitations of the growlnotify itself (not the mudlet function). I've run a workaround for this which killed doublequotes... as such, it now will string.gsub all doublequotes into singlequotes. Also, I've added two sounds (high and low priority), and made it only notify if the window doesn't have focus for low priority. Last thing I did was add an option to make it sticky if you want, as the fourth parameter. Last thing I did was throw in an emergency priority for the alert... didn't feel like making a 5th parameter, so just tacked it in with 'priority'. Low and high folks, that's all there is.
TLDR: I rewrote the above growlNotify() to get rid of a few bugs and give more options.
Attachment is some example triggers that I threw together for Achaea for use with this.
TLDR: I rewrote the above growlNotify() to get rid of a few bugs and give more options.
Attachment is some example triggers that I threw together for Achaea for use with this.
- Attachments
-
- GrowlTriggers.xml
- Triggers for use in Achaea with this version of growlNotify.
- (9.46 KiB) Downloaded 451 times
Re: Growl notifications
Just wanted to necro this thread to say that Wyd's snarl script still works with the latest Snarl version just fine. I updated it to SNP 3.0 "just because" but it functions pretty much out of the box (A few minor changes will be necessary to the return codes if you continue to use SNP 1.0). This is just an excellent feature that I hadn't considered making use of before, and wanted to give it a little boost.