Skip to content

Instantly share code, notes, and snippets.

@lkosak
Last active March 21, 2016 12:39
Show Gist options
  • Save lkosak/5399510 to your computer and use it in GitHub Desktop.
Save lkosak/5399510 to your computer and use it in GitHub Desktop.
eventcmd for mcabber that provides native OSX notifications for incoming messages (requires the terminal-notifier ruby gem)
#!/usr/bin/env ruby
require 'terminal-notifier'
event, arg1, arg2, filename = ARGV
# log = File.open 'eventcmd.log', 'a'
# log.write "#{event}, #{arg1}, #{arg2}, #{filename}\n"
case event
when "MSG"
case arg1
when "IN"
if filename and File.exists?(filename)
msg = File.read filename
File.delete filename
else
msg = ""
end
TerminalNotifier.notify(msg, title: "#{arg2} says...")
when "OUT"
end
when "STATUS"
when "UNREAD"
end
# log.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment