Skip to content

Instantly share code, notes, and snippets.

@BlakeWilliams
Last active October 5, 2015 21:12
Show Gist options
  • Select an option

  • Save BlakeWilliams/887612cf3e082134975e to your computer and use it in GitHub Desktop.

Select an option

Save BlakeWilliams/887612cf3e082134975e to your computer and use it in GitHub Desktop.
# Stupid simple script for OS X that uses the terminal-notifier script to
# send notifications via Notification Center. It has literally 0 configuration.
def weechat_init
Weechat.register(
"terminal_notifier",
"Blake Williams",
"0.2",
"BSD",
"Use terminal-notifier for highlights",
"",
""
)
Weechat.hook_signal("weechat_pv", "show_highlight", "")
Weechat.hook_signal("weechat_highlight", "show_highlight", "")
Weechat::WEECHAT_RC_OK
end
def show_highlight(data, signal, message)
message.gsub!(/\t/, ': ')
message.gsub!(/"/, '\"')
message.gsub!(/`/, '\\`')
message.chomp!
`terminal-notifier -message "#{message}" -title "WeeChat" -sound "Hero"`
Weechat::WEECHAT_RC_OK
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment