SHARE
TWEET

Untitled

a guest Jan 19th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Copyright (C) 2010  Kevin Morris <kevr@exdevelopment.net>
  2. # lnotify made to use for libnotify notifications
  3. # must have /usr/bin/send-notify
  4. # This script was adapted from 'notify'
  5. # Hope you guys like it :O
  6.  
  7. import weechat, string, subprocess
  8.  
  9. weechat.register("lnotify-ng", "kevr", "0.1.1", "GPL3", "lnotify - A libnotify script for weechat", "", "")
  10.  
  11. # Set up here, go no further!
  12. settings = {
  13.     "show_highlight"     : "on",
  14.     "show_priv_msg"      : "on",
  15. }
  16.  
  17. # Init everything
  18. for option, default_value in settings.items():
  19.     if weechat.config_get_plugin(option) == "":
  20.         weechat.config_set_plugin(option, default_value)
  21.  
  22. # Hook privmsg/hilights
  23. weechat.hook_print("", "irc_privmsg", "", 1, "get_notified", "")
  24.  
  25. # Functions
  26. def get_notified(data, bufferp, uber_empty, tagsn, isdisplayed,
  27.         ishilight, prefix, message):
  28.  
  29.     if (weechat.buffer_get_string(bufferp, "localvar_type") == "private" and
  30.             weechat.config_get_plugin('show_priv_msg') == "on"):
  31.         buffer = (weechat.buffer_get_string(bufferp, "short_name") or
  32.                 weechat.buffer_get_string(bufferp, "name"))
  33.         if buffer == prefix:
  34.            subprocess.call(['/usr/bin/notify-send','-i','dialog-information','Weechat', 'In Private Message %s: %s' % (prefix, message)],shell=False)
  35.  
  36.     elif (ishilight == "1" and
  37.             weechat.config_get_plugin('show_highlight') == "on"):
  38.         buffer = (weechat.buffer_get_string(bufferp, "short_name") or
  39.                 weechat.buffer_get_string(bufferp, "name"))
  40.         subprocess.call(['/usr/bin/notify-send','-i','dialog-information','Weechat', 'In %s %s: %s' % (buffer, prefix, message)],shell=False)
  41.  
  42.     return weechat.WEECHAT_RC_OK
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top