Skip to content

Instantly share code, notes, and snippets.

@gryf
Created November 23, 2020 12:13
Show Gist options
  • Select an option

  • Save gryf/2ff99edd3662e5fbcc92d260b5135a4e to your computer and use it in GitHub Desktop.

Select an option

Save gryf/2ff99edd3662e5fbcc92d260b5135a4e to your computer and use it in GitHub Desktop.
import os
import subprocess
import weechat
info = ('notify',
'gryf',
'0.1',
'GPL3',
"Use desktop notify for highlighted & private IRC messages",
'',
'')
def notify_send(data, signal, msgtxt, trial=1):
if os.path.exists(os.path.expanduser("~/.dont_send_notify")):
return weechat.WEECHAT_RC_OK
who, msg = msgtxt.split('\t')
subprocess.call(['notify-send', '--app-name', 'weechat',
'local IRC: ' + who, msg])
return weechat.WEECHAT_RC_OK
if weechat.register(*info):
weechat.hook_signal('weechat_highlight', 'notify_send', '')
weechat.hook_signal('weechat_pv', 'notify_send', '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment