All pastes #1497521 Raw Edit

Stuff

public python v1 · immutable
#1497521 ·published 2009-07-16 21:22 UTC
rendered paste body
"""custom_beep.py - invokes a system command on highlight or private messageuse /set *custom_beep* to list the optionsto alter the custom_beep command change the option custom_beep_cmd"""import osimport weechatweechat.register("custom_beep", "", "0.1",                 "Public domain", "Python version of Beep for weechat", "", "")settings = {    'custom_beep_highlight': 'on',    'custom_beep_pv': 'on',    'custom_beep_cmd': 'beep.sh'    }for option, default in settings.items():    if weechat.config_get_plugin(option) == '':        weechat.config_set_plugin(option, default)def highlight(*args):    if weechat.config_get_plugin('custom_beep_highlight') == 'on':        beep_cmd = weechat.config_get_plugin('custom_beep_cmd')        os.system(beep_cmd)    return weechat.WEECHAT_RC_OKdef pv(*args):    if weechat.config_get_plugin('custom_beep_pv') == 'on':        beep_cmd = weechat.config_get_plugin('custom_beep_cmd')        os.system(beep_cmd)    return weechat.WEECHAT_RC_OKweechat.hook_signal("weechat_highlight", "highlight", "")weechat.hook_signal("weechat_pv", "pv", "")