-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgnotify.rb
42 lines (37 loc) · 1.3 KB
/
gnotify.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# - gnotify.rb
# gnotify.rb is a script for Weechat that sends highlight notifications and private messages to the Growl notification framework.
# see http://growl.info/
# It uses the ruby gem meow.
#
# sudo gem install meow
# cp gnotify.rb ~/.weechat/ruby/autoload/
# mkdir ~/.weechat/images/
# cp images/weechat.png ~/.weechat/images/
#for mac os x only
# $: <<
# '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8' <<
# '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0'
require 'stringio'
require 'rubygems'
gem 'meow'
require 'meow'
def weechat_init
Weechat.register("gnotify", "plop@example.com","0.2", "GPL3", "Notify user via growl", "", "")
image = Meow.import_image File.expand_path("~/.weechat/images/weechat.png")
@meow = Meow.new('WeeChat', 'Note', image)
Weechat.hook_signal("weechat_pv", "meow_private_message", "")
Weechat.hook_signal("weechat_highlight", "meow_highlight", "")
return Weechat::WEECHAT_RC_OK
end
def meow_highlight(data,signal,msg)
title = "meow_highlight"
message = "#{msg}"
@meow.notify(title, message)
return Weechat::WEECHAT_RC_OK
end
def meow_private_message(data,signal,msg)
title = "meow_private_message"
message = "#{msg}"
@meow.notify(title, message)
return Weechat::WEECHAT_RC_OK
end