Notifications when not in focus

Post Reply
azuriolinist
Posts: 6
Joined: Tue Sep 01, 2015 4:01 am

Notifications when not in focus

Post by azuriolinist »

Is there some sort of event handler that raises an event when the game outputs something? I'd like to be able to have some sort of sound notification whenever something is happening in the MUD and the client is not in focus, but I can't figure out how to run a script when it does.

I appreciate any help! I'm using Mudlet 3.0.1, under Arch Linux.

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

Re: Notifications when not in focus

Post by Rakon »

Here is what I use; It requires notify-send on linux
Code: [show] | [select all] lua

function notify(notify_msg)
  if hasFocus() == false then
   os.execute(string.format("%s", [[notify-send --hint=int:transient:1 --icon="mudlet/mudlet.png" "Mudlet" "]] .. notify_msg .. [["]]))
  end -- if
end -- notify

azuriolinist
Posts: 6
Joined: Tue Sep 01, 2015 4:01 am

Re: Notifications when not in focus

Post by azuriolinist »

Rakon wrote:Here is what I use; It requires notify-send on linux
Code: [show] | [select all] lua

function notify(notify_msg)
  if hasFocus() == false then
   os.execute(string.format("%s", [[notify-send --hint=int:transient:1 --icon="mudlet/mudlet.png" "Mudlet" "]] .. notify_msg .. [["]]))
  end -- if
end -- notify
Thanks for the reply! Sorry, newbie here, but how do I raise that function when something happens in-game? Set up an alias of some sort?

Post Reply