Permalink
Browse files

init

  • Loading branch information...
0 parents commit 9d68c92baf2fec73f43ed61407bbf4c616b2dd50 @sindresorhus committed Sep 15, 2012
Showing with 60 additions and 0 deletions.
  1. +9 −0 .editorconfig
  2. +1 −0 .gitattributes
  3. +33 −0 notification_center.py
  4. +17 −0 readme.md
  5. BIN screenshot.png
@@ -0,0 +1,9 @@
+# editorconfig.org
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
@@ -0,0 +1 @@
+* text=auto
@@ -0,0 +1,33 @@
+# https://github.com/sindresorhus/weechat-notification-center
+# Requires `pip install pync`
+
+import weechat
+from pync import Notifier
+
+
+SCRIPT_NAME = 'notification_center'
+SCRIPT_AUTHOR = 'Sindre Sorhus <sindresorhus@gmail.com>'
+SCRIPT_VERSION = '0.1'
+SCRIPT_LICENSE = 'MIT'
+SCRIPT_DESC = 'Pass highlights and private messages to the OS X 10.8+ Notification Center'
+
+weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, '', '')
+
+DEFAULT_OPTIONS = {
+ 'show_highlights': 'on',
+ 'show_private_message': 'on',
+}
+
+for key, val in DEFAULT_OPTIONS.items():
+ if not weechat.config_is_set_plugin(key):
+ weechat.config_set_plugin(key, val)
+
+weechat.hook_print('', 'irc_privmsg', '', 1, 'notify', '')
+
+def notify(data, buffer, date, tags, displayed, highlight, prefix, message):
+ if weechat.config_get_plugin('show_highlights') == 'on' and highlight == '1':
+ channel = weechat.buffer_get_string(buffer, 'localvar_channel')
+ Notifier.notify(message, title='%s %s' % (prefix, channel))
+ elif weechat.config_get_plugin('show_private_message') == 'on' and 'notify_private' in tags:
+ Notifier.notify(message, title='%s [private]' % prefix)
+ return weechat.WEECHAT_RC_OK
@@ -0,0 +1,17 @@
+# WeeChat Notification Center
+
+![screenshot](https://raw.github.com/sindresorhus/weechat-notification-center/master/screenshot.png)
+
+[WeeChat](http://www.weechat.org) script to pass highlights and private messages to the OS X 10.8+ Notification Center
+
+
+## Getting Started
+
+- Install [pync](https://github.com/SeTeM/pync): `pip install pync`
+- Put `notification_center.py` in `~/.weechat/python/autoload/`
+
+
+## License
+
+MIT License
+(c) [Sindre Sorhus](http://sindresorhus.com)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9d68c92

Please sign in to comment.